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.

Introduction to WordPress REST API

1,385 views

Published on

The talk introduces WordPress REST API. Slides explain what WP REST API are, how and when we can use them.

Published in: Technology

Introduction to WordPress REST API

  1. 1. Introduction to WP REST API WPDay Pordenone, 13 Novembre 2015 simone d’amico software engineer @ ideato @dymissy sd@ideato.it WPDay Pordenone, 13 Novembre 2015
  2. 2. Introduction to WP REST API PREAMBLE Can WordPress be the best choice for next project?
  3. 3. OH, REALLY?
  4. 4. Buzzwords 2015 angular, react js, mobile app, … very doge such wow
  5. 5. Introduction to WP REST API CONCLUSION WordPress could not be the best solution
  6. 6. Introduction to WP REST API WP REST API
  7. 7. Introduction to WP REST API WP REST API
  8. 8. Introduction to WP REST API WP REST API
  9. 9. Introduction to WP REST API WP REST API
  10. 10. GET /posts VERSION 1 GET /wp-json/wp/v2/posts VERSION 2 - Infrastructure will be included from 4.4 - Endpoints available in the plugin
  11. 11. { "name": "My WordPress Site", "description": "Just another WordPress site", "URL": "http://example.com", "routes": { "/": { "supports": [ "HEAD", "GET" ], "meta": { "self": "http://example.com/wp-json/" } } ...
  12. 12. Introduction to WP REST API Why WP REST API matters?
  13. 13. Y’ALL
  14. 14. Introduction to WP REST API MOBILE APPS mobile applications
  15. 15. SKY IS NOT THE LIMIT YOUR IMAGINATION IS
  16. 16. Introduction to WP REST API WP REST API REFERENCE
  17. 17. /wp-json/wp/v2 Routes and endpoints available /wp-json/wp/v2/posts Create, read, update and delete posts /wp-json/wp/v2/pages Create, read, update and delete pages /wp-json/wp/v2/users Create, read, update and delete users /wp-json/wp/v2/media Create, read, update and delete media items /wp-json/wp/v2/taxonomies Read taxonomies and terms
  18. 18. GET /wp-json/wp/v2/posts List posts GET /wp-json/wp/v2/posts/<id> Read the post <id> POST /wp-json/wp/v2/posts Create a new post PUT /wp-json/wp/v2/posts/<id> Update the post <id> DELETE /wp-json/wp/v2/posts/<id> Delete the post <id>
  19. 19. Introduction to WP REST API Extending WP REST API
  20. 20. Introduction to WP REST API Extending We are able to access to posts, pages, etc… What about custom post types and custom fields?
  21. 21. Introduction to WP REST API CUSTOM FIELDS
  22. 22. https://wordpress.org/plugins/acf-to-wp-api/
  23. 23. Introduction to WP REST API CUSTOM POST TYPES
  24. 24. GET /wp-json/wp/v2/books List books GET /wp-json/wp/v2/books/<id> Read the book <id> POST /wp-json/wp/v2/books Create a new book
  25. 25. Introduction to WP REST API CONCLUSIONS… FOR REAL WP REST API allow developers to build faster and reactive applications
  26. 26. Introduction to WP REST API THANKS https://joind.in/15555
  27. 27. Introduction to WP REST API QUESTIONS ?
  28. 28. Introduction to WP REST API REFERENCE https://developer.wordpress.com/docs/api/ https://make.wordpress.org/core/2015/10/28/rest-api- welcome-the-infrastructure-to-core/ http://jacklenox.com/2015/03/30/building-themes-with-the- wp-rest-api-wordcamp-london-march-2015/ https://github.com/kadamwhite/wordpress-rest-api https://github.com/WP-API/client-js

×