The WP REST API

- WordPress Copenhagen Meetup

Patrick Hesselberg

- WP Udvikler hos Peytz & Co

- Uddannet Web/Multimedie integrator

- Interesse i data, integration og automatisering

 

Peytz:    peytz.dk/medarbejdere/phh

Twitter: @computephh

Github: phh

Spørgsmål

JSON REST API

+

Getting started

HTTP

Discovery

<link rel='https://api.w.org/' href='http://example.dk/wp-json/' />

Basic examples


Få alle posts fra website?

 


Opdater bruger med ID 4?

 


Søgning efter "awesome"?

/wp-json/wp/v2/posts
/wp-json/wp/v2/users/4
/wp-json/wp/v2/posts?filter[s]=awesome

Routes / Endpoints

GET /wp-json/wp/v2/posts

/posts/

GET /wp-json/wp/v2/posts/123
POST /wp-json/wp/v2/posts
DELETE /wp-json/wp/v2/posts/123

Plugins

WP API:

  • Shortcodes
  • Widgets
  • Sidebars
  • Log
  • Menus
  • SearchWP
  • ACF

WP API i Core?

Chicken and Eggs

Progressive Enhancement

Examples

New york times
- Live bloggings tools

http://nytimes.com/live/brussels-airport-explosions-live-coverage/

Humanmade
- Nomadbase

https://nomadbase.io/

AppPresser
- Reactor

http://nomadbase.io/

Disabroad

http://disabroad.org

Hjælperytterne

http://hjaelperytterne.dk/

Peytz WP Dashboard

Tak fordi i lyttede!

Spørgsmål?

Made with Slides.com