Successfully reported this slideshow.
Your SlideShare is downloading. ×

Maine WordPress Meetup JSON REST API, 3/16/2016

Ad
Ad
Ad
Ad
Ad
Ad
Ad
Ad
Ad
Ad
Loading in …3
×

Check these out next

1 of 36 Ad
Advertisement

More Related Content

Slideshows for you (20)

Advertisement

Recently uploaded (20)

Maine WordPress Meetup JSON REST API, 3/16/2016

  1. 1. WordPress JSON REST API Maine WordPress Meetup, Mar. 16, 2016 @andygagnon
  2. 2. Why Does WordPress Need an API? Decoupling WordPress Content from Display
  3. 3. Templates, Plugins, Core
  4. 4. Jeff Bezos, Amazon circa 2002 • All teams will henceforth expose their data and functionality through service interfaces. • Teams must communicate with each other through these interfaces. • There will be no other form of interprocess communication allowed: no direct linking, no direct reads of another team’s data store, no shared-memory model, no back-doors whatsoever. The only communication allowed is via service interface calls over the network. • It doesn’t matter what technology they use. HTTP, Corba, Pubsub, custom protocols — doesn’t matter. • All service interfaces, without exception, must be designed from the ground up to be externalizable. That is to say, the team must plan and design to be able to expose the interface to developers in the outside world. No exceptions. • Anyone who doesn’t do this will be fired. • Thank you; have a nice day!
  5. 5. 1. Build Useful Software 2. Add API 3. Profit
  6. 6. What Does an API Do?
  7. 7. CRUD 90% of web development
  8. 8. REST = REpresentational State Transfer
  9. 9. REST 6 Constraints • Client - Server • Stateless • Uniform Interface • Caching • Layered System • Code on Demand
  10. 10. REST | HTTP API Verbs Nouns Get/Post/Put/Delete URI
  11. 11. Demo http://rest.dev/simple.html
  12. 12. JSON • JavaScript Object Notation • Open Standard for data • Key - Value pairs • Better than XML • http://json.org • http://jsonlint.com • http://jsoneditoronline.org • JSON View Extension
  13. 13. DEMO YouTube API http://rest.dev/you-tube-api.html
  14. 14. Demo GitHub http://api.github.com
  15. 15. WP JSON REST API • Actions = Verbs (Get, Post, Put, Delete) • Routes = URI • Endpoints = Functions, Data returned
  16. 16. WP API • http://v2.wp-api.org • https://wordpress.org/plugins/rest-api/ • WP Version 4.4 • Pretty URLs, Save Permalinks
  17. 17. Demo WP API http://jra.dev/wp-json/wp/v2
  18. 18. Demo PostMan
  19. 19. WP API Common Routes • Posts • Pages • Custom Posts • Categories • Tags • Taxonomies • Users • Comments
  20. 20. Demo ?filter[]= https://codex.wordpress.org/Class_Reference/ WP_Query
  21. 21. Test Data • https://codex.wordpress.org/Theme_Unit_Test
  22. 22. Demo Ajax Plugin http://s2.dev/hello-world
  23. 23. Demo JS Theme http://s2.dev/wp-admin https://github.com/rachelbaker/wcus-demo
  24. 24. All New WordPress
  25. 25. Static Sites
  26. 26. Hybrid Display
  27. 27. Single Page Web App
  28. 28. Native Mobile App
  29. 29. CMS x 2
  30. 30. Other Subjects • Authorization • OAuth1 • OAuth2, SSL required • wp-login • New Routes • SEO • Plugins e.g. Gravity Forms, WooCommerce
  31. 31. WordPress Future Growth • WP API can push WordPress beyond 25% • The new API is fuel for new creativity • New developers
  32. 32. WordPress Development • WP API is a layer of abstraction over PHP/MySQL. • Agnostic front end, now with JSON support. • New admin interfaces can also be created e.g. Calypso
  33. 33. Parting Words from Matt Mullenwegg
  34. 34. GitHub https://github.com/andygagnon/Maine-WordPress-Meetup-JSON-REST-API-demo https://github.com/rachelbaker/wcus-demo
  35. 35. Thanks! @andygagnon http://andregagnon.com

×