Se ha denunciado esta presentación.
Utilizamos tu perfil de LinkedIn y tus datos de actividad para personalizar los anuncios y mostrarte publicidad más relevante. Puedes cambiar tus preferencias de publicidad en cualquier momento.
WP JSON API
A DEEP CODE DIVE INTO HOW TO EXTEND IT
Slides @ http://www.slideshare.net/pbearne
Code@ https://bitbucket.org/...
Paul Bearne @pbearne
Freelance Senior Full Stack WordPress Developer,
Core contribs in WordPress versions 3.9, 4.0, 4.2, 4...
Bearne.ca
Plugin author of:
Author Avatars List ( https://wordpress.org/plugins/author-avatars/ )
WP Bullhorn Job Listing ...
Real-time Publishing for WordPress
Livepress.com
eLearning Solutions Powered by WordPress
UncannyOwl.com
#1 Outsourcing Service For WordPress
Codeable.io
$10 credit : https://codeable.io?coupon_code=WSQWI1
digital production and design agency
jam3.com
WP JSON API
TURNING WORDPRESS INTO AN APPLICATION FRAMEWORK
What will we cover today?
A bit on why it matters
How to install/setup
Where are the docs
What you get out of the box
...
By the end, you should be able to:
Expose a custom post type in the API
View the output of the API
Send data to the API...
Why does it matter?
JSON data for free
Enables advance apps
Standardizes an AJAX endpoint
It makes WordPress an applic...
Install?
WP version 4.6 +
Install the plugin
Check permalinks are set
Test by loading /wp-json/wp/v2/posts
Install Po...
JSONView chrome extension
https://chrome.google.com/webstore/detail/jsonview/chklaanhfefbnpoihckbnefhakgolnmc?hl=en
Postman chrome extension
https://chrome.google.com/webstore/detail/postman-rest-client-packa/fhbjgbiflinjbdggehcddcbncdddo...
Where to get it (V2)?
http://v2.wp-api.org/
https://wordpress.org/plugins/rest-api/
Note: V1 docs are here http://wp-api.o...
What you get out of the box
http://local.wordpress.dev/wp-json/wp/v2
Note: V1 docs are here http://wp-api.org/index-deprec...
Code Read Through
THIS CODE STARTED USING V1, BUT I HAVE ADDED V2 CALLS.
THIS JUST ONE APPROACH.
Questions?
Hire Me...
PAUL@BEARNE.COM
Slides@ http://www.slideshare.net/pbearne
Email: pbearne@gmail.com
Próxima SlideShare
Cargando en…5
×

WP json api

549 visualizaciones

Publicado el

A deep code dive into how to extend it.

Slides as presented at WordCamp Toronto, 2016 on how to use the WP JSON API to add your own end-point for a custom post type or add/change data being returned.

Publicado en: Software
  • Sé el primero en comentar

  • Sé el primero en recomendar esto

WP json api

  1. 1. WP JSON API A DEEP CODE DIVE INTO HOW TO EXTEND IT Slides @ http://www.slideshare.net/pbearne Code@ https://bitbucket.org/bearne/api_demo/src
  2. 2. Paul Bearne @pbearne Freelance Senior Full Stack WordPress Developer, Core contribs in WordPress versions 3.9, 4.0, 4.2, 4.4, 4.5 and 4.6
  3. 3. Bearne.ca Plugin author of: Author Avatars List ( https://wordpress.org/plugins/author-avatars/ ) WP Bullhorn Job Listing ( https://wordpress.org/plugins/bh-staffing-job-listing-and-cv-upload-for-wp/ ) WP Vote (https:// wp-vote.com )
  4. 4. Real-time Publishing for WordPress Livepress.com
  5. 5. eLearning Solutions Powered by WordPress UncannyOwl.com
  6. 6. #1 Outsourcing Service For WordPress Codeable.io $10 credit : https://codeable.io?coupon_code=WSQWI1
  7. 7. digital production and design agency jam3.com
  8. 8. WP JSON API TURNING WORDPRESS INTO AN APPLICATION FRAMEWORK
  9. 9. What will we cover today? A bit on why it matters How to install/setup Where are the docs What you get out of the box How to mess with it
  10. 10. By the end, you should be able to: Expose a custom post type in the API View the output of the API Send data to the API Save data sent to the API Return custom data to an API call
  11. 11. Why does it matter? JSON data for free Enables advance apps Standardizes an AJAX endpoint It makes WordPress an application framework Performance – 15%+ faster https://deliciousbrains.com/comparing-wordpress-rest-api-performance-admin-ajax-php
  12. 12. Install? WP version 4.6 + Install the plugin Check permalinks are set Test by loading /wp-json/wp/v2/posts Install Postman and JSONview chrome tools
  13. 13. JSONView chrome extension https://chrome.google.com/webstore/detail/jsonview/chklaanhfefbnpoihckbnefhakgolnmc?hl=en
  14. 14. Postman chrome extension https://chrome.google.com/webstore/detail/postman-rest-client-packa/fhbjgbiflinjbdggehcddcbncdddomop?hl=en
  15. 15. Where to get it (V2)? http://v2.wp-api.org/ https://wordpress.org/plugins/rest-api/ Note: V1 docs are here http://wp-api.org/index-deprecated.html
  16. 16. What you get out of the box http://local.wordpress.dev/wp-json/wp/v2 Note: V1 docs are here http://wp-api.org/index-deprecated.html
  17. 17. Code Read Through THIS CODE STARTED USING V1, BUT I HAVE ADDED V2 CALLS. THIS JUST ONE APPROACH.
  18. 18. Questions?
  19. 19. Hire Me... PAUL@BEARNE.COM
  20. 20. Slides@ http://www.slideshare.net/pbearne Email: pbearne@gmail.com

×