SlideShare a Scribd company logo
2019 WordCamp Orange County - An Introduction to the WordPress REST API
An introduction to the
WP REST API
Hello, I’m John
I am no expert
Hello, I’m John
I am no expert
OK, let’s dive in
Today we’ll cover
- What is the REST API?
- What problem I was trying to solve
- How I would have solved the issue

without the REST API
- How I used the REST API for fun and profit
- Tools I used
- Where to continue your learning
Today we’ll cover
- What is the REST API?
- What problem I was trying to solve
- How I would have solved the issue

without the REST API
- How I used the REST API for fun and profit
- Tools I used
- Where to continue your learning
Today we’ll cover
- What is the REST API?
- What problem I was trying to solve
- How I would have solved the issue

without the REST API
- How I used the REST API for fun and profit
- Tools I used
- Where to continue your learning
Today we’ll cover
- What is the REST API?
- What problem I was trying to solve
- How I would have solved the issue

without the REST API
- How I used the REST API for fun and profit
- Tools I used
- Where to continue your learning
Today we’ll cover
- What is the REST API?
- What problem I was trying to solve
- How I would have solved the issue

without the REST API
- How I used the REST API for fun and profit
- Tools I used
- Where to continue your learning
Today we’ll cover
- What is the REST API?
- What problem I was trying to solve
- How I would have solved the issue

without the REST API
- How I used the REST API for fun and profit
- Tools I used
- Where to continue your learning
What is the REST API?
“The WordPress REST API provides API endpoints for
WordPress data types that allow developers to interact
with sites remotely by sending and receiving JSON
(JavaScript Object Notation) objects. This enables
developers to create, read and update WordPress content
from client-side JavaScript or from external applications,
even those written in languages beyond PHP.”
- WordPress
REST API Methods
- GET: Retrieve data from server
- POST: Send data to server
- PUT: Change/update data on server
- DELETE: Remove data from server
Other REST API Terms
- Routes & Endpoints
- Requests
- Responses
- Schema
- Controller Classes
The Problem to Solve
2019 WordCamp Orange County - An Introduction to the WordPress REST API
2019 WordCamp Orange County - An Introduction to the WordPress REST API
How I Would Normally
Solve This Issue
Option 1

Shortcode
2019 WordCamp Orange County - An Introduction to the WordPress REST API
2019 WordCamp Orange County - An Introduction to the WordPress REST API
The Challenges w/
The Shortcode
2019 WordCamp Orange County - An Introduction to the WordPress REST API
Option 2

The Listener
2019 WordCamp Orange County - An Introduction to the WordPress REST API
The Challenges w/
The Listener
WP REST API

to the rescue
Step 1

Create a Route
REST API
If you’re using pretty permalinks
yoursite.com/wp-json/
If not
yoursite.com/?rest_route=/
Posts Endpoint
WordPress has a number of built-in
endpoints you can use. For example:



/wp-json/wp/v2/posts
Posts Endpoint
WordPress has a number of built-in
endpoints you can use. For example:



/wp-json/wp/v2/posts/123
https://developer.wordpress.org/rest-api/reference/
2019 WordCamp Orange County - An Introduction to the WordPress REST API
yoursite.com/wp-json/clientname/v1/datahandler/
yoursite.com/wp-json/clientname/v1/datahandler/456
Step 2
Callback Function
2019 WordCamp Orange County - An Introduction to the WordPress REST API
2019 WordCamp Orange County - An Introduction to the WordPress REST API
2019 WordCamp Orange County - An Introduction to the WordPress REST API
2019 WordCamp Orange County - An Introduction to the WordPress REST API
2019 WordCamp Orange County - An Introduction to the WordPress REST API
2019 WordCamp Orange County - An Introduction to the WordPress REST API
2019 WordCamp Orange County - An Introduction to the WordPress REST API
Questions so far?
Let’s Talk Tools
JSON Formatter
A Chrome Extension to make looking
at JSON content a heck of a lot easier.
JSON Formatter
JSON Formatter
Postman
A Mac/Windows/Unix app for easily
testing your API
Postman
A Mac/Windows/Unix app for easily
testing your API
Postman
Learn more at
https://developer.wordpress.org/rest-api/
Any More Questions?
Thank You!
If you have any
comments or
followup questions:
john@vegasgeek.com

More Related Content

Similar to 2019 WordCamp Orange County - An Introduction to the WordPress REST API (20)

PPTX
WordPress Rest API
Brian Layman
 
PPTX
An Introduction to the WP REST API
Edmund Chan
 
PDF
WordCamp Wilmington 2017 WP-API Why?
Evan Mullins
 
PDF
WordCamp Raleigh 2016 - WP API, What is it good for? Absolutely Everything!
Evan Mullins
 
PDF
WORDPRESS_REST_API_WORDPRESS_REST_API.pdf
Angy668409
 
PDF
WordCamp Birmingham 2016 - WP API, What is it good for? Absolutely Everything!
Evan Mullins
 
PDF
Maine WordPress Meetup JSON REST API, 3/16/2016
Andre Gagnon
 
PDF
WP REST API - Adding Your Own Endpoint
Keanan Koppenhaver
 
PPTX
The WordPress REST API as a Springboard for Website Greatness
WP Engine UK
 
PPTX
Using the WordPress REST API
Jonathan Bossenger
 
PDF
Introduction to WordPress REST API
Simone D'Amico
 
PDF
Intro the WordPress REST API by tomhermans
Tom Hermans
 
PDF
JSON REST API for WordPress
Taylor Lovett
 
PDF
Introduction to WordPress Rest API
kishore sahoo
 
PDF
Beyond The Browser - Creating a RESTful Web Service With WordPress
Christopher Reding
 
PPTX
Unerstanding and Using RESTful APIs
SocialDevCamp Chicago
 
PPTX
Understanding and Using Rest APIs (SocialDevCamp Chicago 2009)
Pete Morano
 
PDF
Old WP REST API, New Tricks
WordPress Community Montreal
 
PDF
Building a mini-theme with WordPress REST API
Anthony Montalbano
 
PPTX
A Conversation About the WordPress JSON REST API
HandsOnWP.com
 
WordPress Rest API
Brian Layman
 
An Introduction to the WP REST API
Edmund Chan
 
WordCamp Wilmington 2017 WP-API Why?
Evan Mullins
 
WordCamp Raleigh 2016 - WP API, What is it good for? Absolutely Everything!
Evan Mullins
 
WORDPRESS_REST_API_WORDPRESS_REST_API.pdf
Angy668409
 
WordCamp Birmingham 2016 - WP API, What is it good for? Absolutely Everything!
Evan Mullins
 
Maine WordPress Meetup JSON REST API, 3/16/2016
Andre Gagnon
 
WP REST API - Adding Your Own Endpoint
Keanan Koppenhaver
 
The WordPress REST API as a Springboard for Website Greatness
WP Engine UK
 
Using the WordPress REST API
Jonathan Bossenger
 
Introduction to WordPress REST API
Simone D'Amico
 
Intro the WordPress REST API by tomhermans
Tom Hermans
 
JSON REST API for WordPress
Taylor Lovett
 
Introduction to WordPress Rest API
kishore sahoo
 
Beyond The Browser - Creating a RESTful Web Service With WordPress
Christopher Reding
 
Unerstanding and Using RESTful APIs
SocialDevCamp Chicago
 
Understanding and Using Rest APIs (SocialDevCamp Chicago 2009)
Pete Morano
 
Old WP REST API, New Tricks
WordPress Community Montreal
 
Building a mini-theme with WordPress REST API
Anthony Montalbano
 
A Conversation About the WordPress JSON REST API
HandsOnWP.com
 

More from vegasgeek (18)

PDF
Building an Autonomous Website
vegasgeek
 
PDF
Building An Autonomous Website
vegasgeek
 
PDF
Jetpack: The Swiss Army Knife of Plugins
vegasgeek
 
PDF
Intro to child themes
vegasgeek
 
PDF
Y U No Tell Me? - WordCamp Tampa 2014
vegasgeek
 
PDF
WordPress Use Cases
vegasgeek
 
PDF
Using BuddyPress as a Directory - BuddyCamp Minneapolis 2013
vegasgeek
 
PDF
An into to using $wpdb with your own database tables
vegasgeek
 
PDF
An introduction to WordPress Development
vegasgeek
 
PPTX
An Introduction to Multisite - WordCamp Phoenix
vegasgeek
 
PDF
WCLV - Introduction to child themes
vegasgeek
 
PPTX
WordPress meetup - 10 plugins
vegasgeek
 
PPT
Intro to WordPress Child Themes
vegasgeek
 
PPT
WordCamp Reno 2011 - Intro to Genesis Child Themes
vegasgeek
 
PPTX
Intro to StudioPress child themes
vegasgeek
 
PPTX
Building your first plugin by John Hawkins at WordCamp MSP
vegasgeek
 
PDF
Beginning Plugin d
vegasgeek
 
KEY
Using WordPress as a CMS for Affiliate Marketing
vegasgeek
 
Building an Autonomous Website
vegasgeek
 
Building An Autonomous Website
vegasgeek
 
Jetpack: The Swiss Army Knife of Plugins
vegasgeek
 
Intro to child themes
vegasgeek
 
Y U No Tell Me? - WordCamp Tampa 2014
vegasgeek
 
WordPress Use Cases
vegasgeek
 
Using BuddyPress as a Directory - BuddyCamp Minneapolis 2013
vegasgeek
 
An into to using $wpdb with your own database tables
vegasgeek
 
An introduction to WordPress Development
vegasgeek
 
An Introduction to Multisite - WordCamp Phoenix
vegasgeek
 
WCLV - Introduction to child themes
vegasgeek
 
WordPress meetup - 10 plugins
vegasgeek
 
Intro to WordPress Child Themes
vegasgeek
 
WordCamp Reno 2011 - Intro to Genesis Child Themes
vegasgeek
 
Intro to StudioPress child themes
vegasgeek
 
Building your first plugin by John Hawkins at WordCamp MSP
vegasgeek
 
Beginning Plugin d
vegasgeek
 
Using WordPress as a CMS for Affiliate Marketing
vegasgeek
 
Ad

Recently uploaded (20)

PPTX
Introduction to Flutter by Ayush Desai.pptx
ayushdesai204
 
PDF
Build with AI and GDG Cloud Bydgoszcz- ADK .pdf
jaroslawgajewski1
 
PPTX
Applied-Statistics-Mastering-Data-Driven-Decisions.pptx
parmaryashparmaryash
 
PPTX
Simple and concise overview about Quantum computing..pptx
mughal641
 
PDF
How ETL Control Logic Keeps Your Pipelines Safe and Reliable.pdf
Stryv Solutions Pvt. Ltd.
 
PDF
Trying to figure out MCP by actually building an app from scratch with open s...
Julien SIMON
 
PDF
How Open Source Changed My Career by abdelrahman ismail
a0m0rajab1
 
PPTX
AI in Daily Life: How Artificial Intelligence Helps Us Every Day
vanshrpatil7
 
PDF
Generative AI vs Predictive AI-The Ultimate Comparison Guide
Lily Clark
 
PDF
RAT Builders - How to Catch Them All [DeepSec 2024]
malmoeb
 
PDF
The Future of Mobile Is Context-Aware—Are You Ready?
iProgrammer Solutions Private Limited
 
PPTX
OA presentation.pptx OA presentation.pptx
pateldhruv002338
 
PDF
GDG Cloud Munich - Intro - Luiz Carneiro - #BuildWithAI - July - Abdel.pdf
Luiz Carneiro
 
PDF
Per Axbom: The spectacular lies of maps
Nexer Digital
 
PDF
Data_Analytics_vs_Data_Science_vs_BI_by_CA_Suvidha_Chaplot.pdf
CA Suvidha Chaplot
 
PDF
CIFDAQ's Market Wrap : Bears Back in Control?
CIFDAQ
 
PDF
A Strategic Analysis of the MVNO Wave in Emerging Markets.pdf
IPLOOK Networks
 
PDF
Structs to JSON: How Go Powers REST APIs
Emily Achieng
 
PDF
MASTERDECK GRAPHSUMMIT SYDNEY (Public).pdf
Neo4j
 
PDF
Research-Fundamentals-and-Topic-Development.pdf
ayesha butalia
 
Introduction to Flutter by Ayush Desai.pptx
ayushdesai204
 
Build with AI and GDG Cloud Bydgoszcz- ADK .pdf
jaroslawgajewski1
 
Applied-Statistics-Mastering-Data-Driven-Decisions.pptx
parmaryashparmaryash
 
Simple and concise overview about Quantum computing..pptx
mughal641
 
How ETL Control Logic Keeps Your Pipelines Safe and Reliable.pdf
Stryv Solutions Pvt. Ltd.
 
Trying to figure out MCP by actually building an app from scratch with open s...
Julien SIMON
 
How Open Source Changed My Career by abdelrahman ismail
a0m0rajab1
 
AI in Daily Life: How Artificial Intelligence Helps Us Every Day
vanshrpatil7
 
Generative AI vs Predictive AI-The Ultimate Comparison Guide
Lily Clark
 
RAT Builders - How to Catch Them All [DeepSec 2024]
malmoeb
 
The Future of Mobile Is Context-Aware—Are You Ready?
iProgrammer Solutions Private Limited
 
OA presentation.pptx OA presentation.pptx
pateldhruv002338
 
GDG Cloud Munich - Intro - Luiz Carneiro - #BuildWithAI - July - Abdel.pdf
Luiz Carneiro
 
Per Axbom: The spectacular lies of maps
Nexer Digital
 
Data_Analytics_vs_Data_Science_vs_BI_by_CA_Suvidha_Chaplot.pdf
CA Suvidha Chaplot
 
CIFDAQ's Market Wrap : Bears Back in Control?
CIFDAQ
 
A Strategic Analysis of the MVNO Wave in Emerging Markets.pdf
IPLOOK Networks
 
Structs to JSON: How Go Powers REST APIs
Emily Achieng
 
MASTERDECK GRAPHSUMMIT SYDNEY (Public).pdf
Neo4j
 
Research-Fundamentals-and-Topic-Development.pdf
ayesha butalia
 
Ad

2019 WordCamp Orange County - An Introduction to the WordPress REST API