Slide 1

Slide 1 text

Konstantinos Kouratoras - 5th Crete WordPress Meetup - April 2016 INTRODUCTION TO WORDPRESS REST API

Slide 2

Slide 2 text

Konstantinos Kouratoras - 5th Crete WordPress Meetup - April 2016 Hello! Tester @ OnTheGoSystems Follow me @kouratoras

Slide 3

Slide 3 text

Konstantinos Kouratoras - 5th Crete WordPress Meetup - April 2016 WORDPRESS REST API

Slide 4

Slide 4 text

Konstantinos Kouratoras - 5th Crete WordPress Meetup - April 2016 WORDPRESS REST API What else? :)

Slide 5

Slide 5 text

Konstantinos Kouratoras - 5th Crete WordPress Meetup - April 2016 WORDPRESS REST API Application Program Interface

Slide 6

Slide 6 text

Konstantinos Kouratoras - 5th Crete WordPress Meetup - April 2016 WORDPRESS REST API REpresentational State Transfer

Slide 7

Slide 7 text

Konstantinos Kouratoras - 5th Crete WordPress Meetup - April 2016 • Actions • GET, POST, PUT, DELETE • Resources • GET /posts/ • GET /posts/12 • POST /posts/ • PUT /posts/13 • DELETE /posts/14

Slide 8

Slide 8 text

No content

Slide 9

Slide 9 text

No content

Slide 10

Slide 10 text

No content

Slide 11

Slide 11 text

No content

Slide 12

Slide 12 text

Konstantinos Kouratoras - 5th Crete WordPress Meetup - April 2016 WORDPRESS REST API

Slide 13

Slide 13 text

Konstantinos Kouratoras - 5th Crete WordPress Meetup - April 2016 PHP API the_post(), the_content(), the_title(), etc.

Slide 14

Slide 14 text

No content

Slide 15

Slide 15 text

Konstantinos Kouratoras - 5th Crete WordPress Meetup - April 2016 PHP API

Slide 16

Slide 16 text

Konstantinos Kouratoras - 5th Crete WordPress Meetup - April 2016 PHP API

Slide 17

Slide 17 text

Konstantinos Kouratoras - 5th Crete WordPress Meetup - April 2016 REST PHP API

Slide 18

Slide 18 text

Konstantinos Kouratoras - 5th Crete WordPress Meetup - April 2016 • Javascript • Angular, React, Ember, Backbone, Node,… • Single Page Applications • Better interfaces • Mobile integration • Third party applications

Slide 19

Slide 19 text

Konstantinos Kouratoras - 5th Crete WordPress Meetup - April 2016 HISTORY

Slide 20

Slide 20 text

Konstantinos Kouratoras - 5th Crete WordPress Meetup - April 2016 • JSON API plugin • Ruby on Rails front-end (2009) • WP REST API • Google Summer of Code 2013 • Basic infrastructure in WordPress 4.4 • Full merge in 4.5? 4.6? 4.7?

Slide 21

Slide 21 text

Konstantinos Kouratoras - 5th Crete WordPress Meetup - April 2016 INSTALLATION

Slide 22

Slide 22 text

No content

Slide 23

Slide 23 text

Konstantinos Kouratoras - 5th Crete WordPress Meetup - April 2016 • As any other WordPress plugin • Download, install and activate • https://wordpress.org/plugins/rest-api/ • Ready!

Slide 24

Slide 24 text

Konstantinos Kouratoras - 5th Crete WordPress Meetup - April 2016 EXAMPLE

Slide 25

Slide 25 text

Konstantinos Kouratoras - 5th Crete WordPress Meetup - April 2016 /wp-json/posts/21433

Slide 26

Slide 26 text

Konstantinos Kouratoras - 5th Crete WordPress Meetup - April 2016 /wp-json/taxonomies

Slide 27

Slide 27 text

Konstantinos Kouratoras - 5th Crete WordPress Meetup - April 2016 • GET Request • 200 OK • JSON Response • No Authentication

Slide 28

Slide 28 text

Konstantinos Kouratoras - 5th Crete WordPress Meetup - April 2016 • /wp-json/posts/ • /wp-json/posts/21433 • /wp-json/pages • /wp-json/taxonomies • /wp-json/comments

Slide 29

Slide 29 text

Konstantinos Kouratoras - 5th Crete WordPress Meetup - April 2016 /wp-json/users

Slide 30

Slide 30 text

Konstantinos Kouratoras - 5th Crete WordPress Meetup - April 2016 • Authentication • Cookies (Onsite) • Basic Authentication, Application Passwords, OAuth authentication (Offsite)

Slide 31

Slide 31 text

Konstantinos Kouratoras - 5th Crete WordPress Meetup - April 2016 EXTENSIONS

Slide 32

Slide 32 text

Konstantinos Kouratoras - 5th Crete WordPress Meetup - April 2016 • Custom Endpoints • Custom Responses • Custom Content Types • JavaScript/Backbone Client • v2.wp-api.org/extending/javascript-client/

Slide 33

Slide 33 text

Konstantinos Kouratoras - 5th Crete WordPress Meetup - April 2016 RESOURCES v2.wp-api.org github.com/WP-API/WP-API wordpress.org/plugins/rest-api

Slide 34

Slide 34 text

Konstantinos Kouratoras - 5th Crete WordPress Meetup - April 2016 THANK YOU! Questions?