Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
WhattheWordPressRESTAPI
meansforJavascriptDevelopers
JakeSpurlock
@whyisjake
Hi
Node.js
Wait,what?
FAST
NODE IS
php.JS
WordPress.JS
Chipotle.JS
// Let’s get this burrito bowl going…
chipotle.create({
type: 'bowl',
options: {
rice: 'white',
beans: 'pinto',
meat: 'chi...
WPAPI
WIRED
EXPRESS
https://www.npmjs.com/package/wpapi
github.com/whyisjake/wired-express
CRUD
Build an “App”
10K+CONCURRENT VIEWERS
WIRED.COM LIVEBLOGS
What about
Tumblr?
RE-EVALUATE LIVEBLOGS
Complexity.
Simple
// Let's loop through each one, and add the response to post
meta.
// As we get posts, also push those to the main $posts ...
This is silly.
Make posts,damnit.
Slack
Livebot
Livebotisanodeapplicationthatlistensfor
requestsfromSlackandrespondswithrequests
toaWordPressRESTAPIendpointtomanage
liveb...
Sunstone
•30+years
•3500sessions
•Thousandsofpresenters
Sunstone
JakeSpurlock
@whyisjake
What the WordPress REST API Means for Javascript Developers
What the WordPress REST API Means for Javascript Developers
What the WordPress REST API Means for Javascript Developers
What the WordPress REST API Means for Javascript Developers
What the WordPress REST API Means for Javascript Developers
What the WordPress REST API Means for Javascript Developers
What the WordPress REST API Means for Javascript Developers
What the WordPress REST API Means for Javascript Developers
What the WordPress REST API Means for Javascript Developers
What the WordPress REST API Means for Javascript Developers
What the WordPress REST API Means for Javascript Developers
What the WordPress REST API Means for Javascript Developers
What the WordPress REST API Means for Javascript Developers
What the WordPress REST API Means for Javascript Developers
What the WordPress REST API Means for Javascript Developers
What the WordPress REST API Means for Javascript Developers
What the WordPress REST API Means for Javascript Developers
What the WordPress REST API Means for Javascript Developers
What the WordPress REST API Means for Javascript Developers
Upcoming SlideShare
Loading in …5
×

What the WordPress REST API Means for Javascript Developers

2,624 views

Published on

Slides from my talk at OpenWest 2016 about the WordPress REST API.

Published in: Internet
  • Be the first to comment

  • Be the first to like this

What the WordPress REST API Means for Javascript Developers

  1. 1. WhattheWordPressRESTAPI meansforJavascriptDevelopers
  2. 2. JakeSpurlock @whyisjake
  3. 3. Hi
  4. 4. Node.js
  5. 5. Wait,what?
  6. 6. FAST NODE IS
  7. 7. php.JS
  8. 8. WordPress.JS
  9. 9. Chipotle.JS
  10. 10. // Let’s get this burrito bowl going… chipotle.create({ type: 'bowl', options: { rice: 'white', beans: 'pinto', meat: 'chicken', salsa: [ 'green', ‘corn' ], cream: true, cheese: true, guacamole: true, notes: 'Extra guac please!’ } });
  11. 11. WPAPI
  12. 12. WIRED EXPRESS
  13. 13. https://www.npmjs.com/package/wpapi
  14. 14. github.com/whyisjake/wired-express
  15. 15. CRUD
  16. 16. Build an “App”
  17. 17. 10K+CONCURRENT VIEWERS WIRED.COM LIVEBLOGS
  18. 18. What about Tumblr? RE-EVALUATE LIVEBLOGS
  19. 19. Complexity.
  20. 20. Simple
  21. 21. // Let's loop through each one, and add the response to post meta. // As we get posts, also push those to the main $posts array. // Reversing this so that we have some better logic for updating posts. // Ideally, you don't need to loop through every page, you could just // update the most recent page or two. for ( $i = 0; $i < $times; $i++ ) { // Fetch a batch of posts $response = $this->fetch_and_parse( $url, $i ); $more_posts = $response['response']['posts']; $more_posts = $this->clean_tumblr_response( $more_posts ); if ( ! empty( $more_posts ) ) { update_post_meta( $post_id, 'liveblog_posts_page_' . $i, $more_posts ); } // Add each of the posts to the main post array. foreach ( $more_posts as $post ) { $posts[] = $post; } }
  22. 22. This is silly.
  23. 23. Make posts,damnit.
  24. 24. Slack
  25. 25. Livebot
  26. 26. Livebotisanodeapplicationthatlistensfor requestsfromSlackandrespondswithrequests toaWordPressRESTAPIendpointtomanage liveblogposts.Theapplicationisbestthoughtof asamiddlewarethattranslatesrequestsbetween theSlackserverandWordPress.Theapplication itselfhasnoexternaldependencies(e.g., database,cache),makingtheapplicationvery easytorun.
  27. 27. Sunstone
  28. 28. •30+years •3500sessions •Thousandsofpresenters Sunstone
  29. 29. JakeSpurlock @whyisjake

×