Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Publish a Post Screaming

Publish a Post Screaming

The main idea of this talk is to show new possibilities about how you can interact the WP REST API with small devices like RaspberryPi.

This talk was presented in WordCamp New York City 2018:
https://2018.nyc.wordcamp.org/sessions/#wcorg-session-2742

This talk was presented in WordCamp Miami 2018: https://2018.miami.wordcamp.org/session/interacting-with-wordpress-w-raspberry-pi-rest-api/

Here is the result of the presentation: http://rest.donini.me/congratulations-wordcamp-miami-2018-you-reach-36-decibels-wcmia/

Rodrigo Donini

March 17, 2018
Tweet

More Decks by Rodrigo Donini

Other Decks in Programming

Transcript

  1. by Rodrigo Donini
    @donini
    PUBLISH A POST
    SCREAMING
    WordCamp New York 2018

    View Slide

  2. Hire the top 3% of freelance talent www.toptal.com
    Toptal Confidential
    HELLO!
    I’m Donini
    You can find me on Twitter,
    GitHub and LinkedIn as @donini
    My Site / Blog: www.donini.me
    Apply for Toptal:
    http://bit.ly/donini-toptal

    View Slide

  3. Hire the top 3% of freelance talent www.toptal.com
    Toptal Confidential
    WordCamp Buenos Aires - AR
    WordCamp San José - CR
    WordCamp Toronto - CA
    WordCamp Porto Alegre - BR
    Where I
    live
    São
    Leopoldo
    MORE THEN 37
    THOUSAND MILES
    (+68 thousand
    kilometers)
    TO ATTEND
    WORDCAMPS
    WordCamp São Paulo - BR
    WordCamp Miami - US
    WordCamp New York - US

    View Slide

  4. @donini

    View Slide

  5. Hire the top 3% of freelance talent www.toptal.com
    Toptal Confidential
    Hire the 3% of the best
    freelancers in the world.
    WHO IS
    http://bit.ly/donini-toptal
    @donini

    View Slide

  6. Hire the top 3% of freelance talent www.toptal.com
    Toptal Confidential
    !
    The challenges
    !
    Landscape
    !
    References
    !
    Overview of the REST-API
    !
    Decibel-meter Package
    !
    Live code
    !
    Live preview
    Agenda
    @donini

    View Slide

  7. Hire the top 3% of freelance talent www.toptal.com
    Toptal Confidential
    The Main Challenges
    @donini
    • Consume and show a
    practical example of using
    the WP REST API
    • Interact with the audience
    somehow.

    View Slide

  8. Hire the top 3% of freelance talent www.toptal.com
    Toptal Confidential
    Landscape (The Premise)
    @donini
    The audience make some noise
    (Scream for example)
    If the system reach a
    number of decibels
    A new post will be published
    through the REST API

    View Slide

  9. Hire the top 3% of freelance talent www.toptal.com
    Toptal Confidential
    Quick overview of the REST-API
    @donini
    Characteristics of the WordPress REST API:
    1) It’s possible manipulate posts, custom-posts, pages, categories,
    tags, comments, taxonomies, media, users and settings;
    2) Uses the HTTP methods to transmit data, like POST, GET, PUT,
    DELETE;
    3) Don’t need extra knowledge of PHP.

    View Slide

  10. Hire the top 3% of freelance talent www.toptal.com
    Toptal Confidential
    Using the REST-API
    @donini
    Endpoints to manipulate posts:
    Create: POST /wp/v2/posts
    Update: POST /wp/v2/posts/
    Delete: DELETE /wp/v2/posts/
    List: GET /wp/v2/posts
    Restore: GET /wp/v2/posts/
    https://developer.wordpress.org/rest-api/reference/posts/

    View Slide

  11. Hire the top 3% of freelance talent www.toptal.com
    Toptal Confidential
    @donini
    https://developer.wordpress.org/rest-api/reference/posts/
    In this project we used two Endpoints
    To create the post in WordPress:
    Create: POST /wp/v2/posts
    To upload the media file:
    Create: POST /wp/v2/media

    View Slide

  12. Hire the top 3% of freelance talent www.toptal.com
    Toptal Confidential
    Some applications of the REST-API
    @donini
    1) Build websites or webapps using React.js, Angular.js, Vue.js, etc;
    2) Build mobile apps using Java (Android), Swift (iOS), etc;
    3) Integrate with any device that supports REST APIs;

    View Slide

  13. Hire the top 3% of freelance talent www.toptal.com
    Toptal Confidential
    Decibel-meter Package
    @donini
    1) Connects in audio devices;
    2) Process and capture the decibels;

    View Slide

  14. Hire the top 3% of freelance talent www.toptal.com
    Toptal Confidential
    References and Libs
    @donini
    1) Project in Github
    - https://github.com/donini/scream-and-post
    3) WP REST API
    - https://developer.wordpress.org/rest-api/reference/
    4) Decibel-meter npm package
    - https://www.npmjs.com/package/decibel-meter
    5) Express npm package
    - http://expressjs.com/
    6) Gifshot
    - https://github.com/yahoo/gifshot

    View Slide

  15. Hire the top 3% of freelance talent www.toptal.com
    Toptal Confidential
    Live code
    @donini

    View Slide

  16. Hire the top 3% of freelance talent www.toptal.com
    Toptal Confidential
    Live preview
    @donini
    http://rest.donini.me/

    View Slide

  17. THANKS!
    You can find me on Twitter,
    GitHub and LinkedIn as @donini
    My Site / Blog: www.donini.me
    QUESTIONS?
    Apply to Toptal:
    http://bit.ly/donini-toptal

    View Slide

  18. Hire the top 3% of freelance talent www.toptal.com
    Toptal Confidential
    FTM & CoffeePress
    @donini
    http://bit.ly/coffeepressyt

    View Slide