Top Banner
Introduction to WP REST API WPDay Pordenone, 13 Novembre 2015 simone d’amico software engineer @ ideato @dymissy [email protected] WPDay Pordenone, 13 Novembre 2015
34

Introduction to WordPress REST API

Feb 16, 2017

Download

Technology

Simone D'Amico
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Introduction to WordPress REST API

Introduction to WP REST API

WPDay Pordenone, 13 Novembre 2015

simone d’amico software engineer @ ideato

@dymissy [email protected]

WPDay Pordenone, 13 Novembre 2015

Page 2: Introduction to WordPress REST API

Introduction to WP REST API

PREAMBLE

Can WordPress be the best choice for next

project?

Page 3: Introduction to WordPress REST API
Page 4: Introduction to WordPress REST API

OH, REALLY?

Page 5: Introduction to WordPress REST API

Buzzwords 2015angular, react js, mobile app, …

very doge such wow

Page 6: Introduction to WordPress REST API

Introduction to WP REST API

CONCLUSION

WordPress could not be the best solution

Page 7: Introduction to WordPress REST API
Page 8: Introduction to WordPress REST API

Introduction to WP REST API

WP REST API

Page 9: Introduction to WordPress REST API

Introduction to WP REST API

WP REST API

Page 10: Introduction to WordPress REST API

Introduction to WP REST API

WP REST API

Page 11: Introduction to WordPress REST API

Introduction to WP REST API

WP REST API

Page 13: Introduction to WordPress REST API

{ "name": "My WordPress Site", "description": "Just another WordPress site", "URL": "http:\/\/example.com", "routes": { "\/": { "supports": [ "HEAD", "GET" ], "meta": { "self": "http:\/\/example.com\/wp-json\/" } } ...

Page 14: Introduction to WordPress REST API

Introduction to WP REST API

Why WP REST API matters?

Page 15: Introduction to WordPress REST API
Page 16: Introduction to WordPress REST API

Y’ALL

Page 17: Introduction to WordPress REST API

Introduction to WP REST API

MOBILE APPS

mobile applications

Page 18: Introduction to WordPress REST API

SKY IS NOT THE LIMIT

YOUR IMAGINATION IS

Page 19: Introduction to WordPress REST API

Introduction to WP REST API

WP REST API REFERENCE

Page 20: Introduction to WordPress REST API

/wp-json/wp/v2 Routes and endpoints available

/wp-json/wp/v2/postsCreate, read, update and delete posts

/wp-json/wp/v2/pagesCreate, read, update and delete pages

/wp-json/wp/v2/usersCreate, read, update and delete users

/wp-json/wp/v2/mediaCreate, read, update and delete media items

/wp-json/wp/v2/taxonomies Read taxonomies and terms

Page 21: Introduction to WordPress REST API

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>

Page 22: Introduction to WordPress REST API

Introduction to WP REST API

Extending WP REST API

Page 23: Introduction to WordPress REST API

Introduction to WP REST API

Extending

We are able to access to posts, pages, etc…

What about custom post types and custom fields?

Page 24: Introduction to WordPress REST API

Introduction to WP REST API

CUSTOM FIELDS

Page 25: Introduction to WordPress REST API
Page 26: Introduction to WordPress REST API
Page 28: Introduction to WordPress REST API
Page 29: Introduction to WordPress REST API

Introduction to WP REST API

CUSTOM POST TYPES

Page 30: Introduction to WordPress REST API

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

Page 31: Introduction to WordPress REST API

Introduction to WP REST API

CONCLUSIONS… FOR REAL

WP REST API allow developers to build faster and reactive applications

Page 32: Introduction to WordPress REST API

Introduction to WP REST API

THANKS

https://joind.in/15555

Page 33: Introduction to WordPress REST API

Introduction to WP REST API

QUESTIONS

?

Page 34: Introduction to WordPress REST API

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