introduction to wordpress rest api

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

Upload: simone-damico

Post on 16-Feb-2017

934 views

Category:

Technology


4 download

TRANSCRIPT

Introduction to WP REST API

WPDay Pordenone, 13 Novembre 2015

simone d’amico software engineer @ ideato

@dymissy [email protected]

WPDay Pordenone, 13 Novembre 2015

Introduction to WP REST API

PREAMBLE

Can WordPress be the best choice for next

project?

OH, REALLY?

Buzzwords 2015angular, react js, mobile app, …

very doge such wow

Introduction to WP REST API

CONCLUSION

WordPress could not be the best solution

Introduction to WP REST API

WP REST API

Introduction to WP REST API

WP REST API

Introduction to WP REST API

WP REST API

Introduction to WP REST API

WP 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\/" } } ...

Introduction to WP REST API

Why WP REST API matters?

Y’ALL

Introduction to WP REST API

MOBILE APPS

mobile applications

SKY IS NOT THE LIMIT

YOUR IMAGINATION IS

Introduction to WP REST API

WP REST API REFERENCE

/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

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>

Introduction to WP REST API

Extending WP 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?

Introduction to WP REST API

CUSTOM FIELDS

Introduction to WP REST API

CUSTOM POST TYPES

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

Introduction to WP REST API

CONCLUSIONS… FOR REAL

WP REST API allow developers to build faster and reactive applications

Introduction to WP REST API

THANKS

https://joind.in/15555

Introduction to WP REST API

QUESTIONS

?

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