SlideShare a Scribd company logo
1 of 24
Download to read offline
JSON REST API for WordPress 
@tlovett12 
+ JSON 
REST API 
=
Who Am I? 
• My name is Taylor Lovett! 
• Director of Web Engineering at 10up 
• Open source community member 
• WordPress core contributor 
• WP API team member 
@tlovett12
We are hiring! 
@tlovett12
So what’s this new WordPress API 
thing all about? Don’t we already have 
one?
Right now, we have XML-RPC. 
Remote Procedural Call API’s are part of an old standard. They 
are very difficult to use.
Why JSON REST API? 
• In a nutshell, JSON REST API’s have swept the 
web becoming an almost standard. They are 
extremely intuitive and provide an easy way to 
distribute, collect, and modify data. 
Let’s break it down a bit.
JSON 
• JSON is an abbreviation for “JavaScript Object Notation” 
• It’s simply a way to describe data that is lightweight and 
extremely easy to use. Arguably much easier to use than 
XML.
REST 
• REST (Representational State Transfer) is an architectural style 
that dictates how HTTP and URI’s should be used and organized. 
• Verbs and resources: GET /post/1 
• Hypermedia as the Engine of Application State (HATEOAS) - 
Server provides everything you need to know how to use it in a 
response. 
• Actions are autonomous and do not depend on each other. 
• Bottom line: RESTful API’s have become extremely popular 
across the web. They are much easier to use than things like RPC 
or SOAP.
And of course, API 
• An API (Application Programming Interface) is a 
set of entry points that allow you to interact with 
a platform (WordPress in this case).
How can I start using it now?
First, install the plugin 
http://wordpress.org/plugins/json-rest-api/ 
! 
Core integration coming soon.
What does the API let me to do? 
/wp-json/ 
Shows all the routes and endpoints available 
/wp-json/posts 
Create, read, update, and delete posts 
/wp-json/users 
Create, read, update, and delete users 
/wp-json/media 
Create, read, update, and delete media items 
/wp-json/taxonomies 
Read taxonomies and terms 
/wp-json/pages/ 
Create, read, update, and delete pages
The API is rich with functionality. 
Explore the documentation! 
http://wp-api.org
The basic building block of 
WordPress is the post. 
http://codex.wordpress.org/Writing_Posts
List Posts 
[{! 
"ID": 11297,! 
"title": "Post 19",! 
"status": "publish",! 
"type": "post",! 
"author": 1,! 
"content": "",! 
"parent": null,! 
"link": "http://example.com/2014/08/post-19/",! 
"format": "standard",! 
"slug": "post-19",! 
"guid": "http://example.com/2014/08/post-19/",! 
"excerpt": null,! 
"menu_order": 0,! 
"comment_status": "closed",! 
"ping_status": "open",! 
"sticky": false,! 
"meta": {},! 
"featured_image": null,! 
"terms": {}! 
}] 
GET /wp-json/posts
List Posts 
GET /wp-json/posts 
Takes a number of useful parameters: 
• Filter[]: Accepts WP_Query arguments 
http://codex.wordpress.org/Class_Reference/WP_Query 
• Page: Allows for pagination 
• Context: Determines usage context i.e. “view or edit” 
• … 
https://github.com/WP-API/WP-API/blob/master/docs/routes/routes.md
Retrieve A Post 
{! 
"ID": 11297,! 
"title": "Post 19",! 
"status": "publish",! 
"type": "post",! 
"author": 1,! 
"content": "",! 
"parent": null,! 
"link": "http://example.com/2014/08/post-19/",! 
"format": "standard",! 
"slug": "post-19",! 
"guid": "http://example.com/2014/08/post-19/",! 
"excerpt": null,! 
"menu_order": 0,! 
"comment_status": "closed",! 
"ping_status": "open",! 
"sticky": false,! 
"meta": {},! 
"featured_image": null,! 
"terms": {}! 
} 
GET /wp-json/posts/<id>
Edit A Post 
PUT /wp-json/posts/<id> 
curl -X PUT -H “Content-Type: application/json” -d ‘! 
{! 
"title": “Updated Title",! 
“content_raw": “Updated post content"! 
}! 
‘ -u admin:password http://example.com/wp-json/posts/<id> 
We need to send a PUT request to this endpoint with 
our post data. Of course we must authenticate before 
doing this.
Create A Post 
POST /wp-json/posts/ 
curl -X POST -H “Content-Type: application/json” -d ‘! 
{! 
"title": “Title",! 
“content_raw": “Post content"! 
}! 
‘ -u admin:password http://example.com/wp-json/posts/ 
Notice we are using a POST request this time.
Build Your Own Routes and Endpoints 
WP API is very extensible 
http://wp-api.org/guides/extending.html
What can I do with the JSON 
REST API for WordPress?
ANYTHING!!!!
If you learned nothing so far, 
know this: 
You can do amazing things with the JSON REST 
API for WordPress. 
Soon ~23% of the web will be using this API.
Questions? 
@tlovett12! 
taylor.lovett@10up.com! 
taylorlovett.com 
We need to send a PUT request to this endpoint with 
our post data. Of course we must authenticate before 
doing this.

More Related Content

What's hot

Transforming WordPress Search and Query Performance with Elasticsearch
Transforming WordPress Search and Query Performance with Elasticsearch Transforming WordPress Search and Query Performance with Elasticsearch
Transforming WordPress Search and Query Performance with Elasticsearch Taylor Lovett
 
Beyond The Browser - Creating a RESTful Web Service With WordPress
Beyond The Browser - Creating a RESTful Web Service With WordPressBeyond The Browser - Creating a RESTful Web Service With WordPress
Beyond The Browser - Creating a RESTful Web Service With WordPressChristopher Reding
 
Modernizing WordPress Search with Elasticsearch
Modernizing WordPress Search with ElasticsearchModernizing WordPress Search with Elasticsearch
Modernizing WordPress Search with ElasticsearchTaylor Lovett
 
Unlocking the Magical Powers of WP_Query
Unlocking the Magical Powers of WP_QueryUnlocking the Magical Powers of WP_Query
Unlocking the Magical Powers of WP_QueryDustin Filippini
 
Optimization of modern web applications
Optimization of modern web applicationsOptimization of modern web applications
Optimization of modern web applicationsEugene Lazutkin
 
ClubAJAX Basics - Server Communication
ClubAJAX Basics - Server CommunicationClubAJAX Basics - Server Communication
ClubAJAX Basics - Server CommunicationMike Wilcox
 
Exciting JavaScript - Part II
Exciting JavaScript - Part IIExciting JavaScript - Part II
Exciting JavaScript - Part IIEugene Lazutkin
 
WordPress REST API v2: Overview & Exploring
WordPress REST API v2: Overview & ExploringWordPress REST API v2: Overview & Exploring
WordPress REST API v2: Overview & ExploringNick Pelton
 
SenchaCon 2016: LinkRest - Modern RESTful API Framework for Ext JS Apps - Rou...
SenchaCon 2016: LinkRest - Modern RESTful API Framework for Ext JS Apps - Rou...SenchaCon 2016: LinkRest - Modern RESTful API Framework for Ext JS Apps - Rou...
SenchaCon 2016: LinkRest - Modern RESTful API Framework for Ext JS Apps - Rou...Sencha
 
Hypermedia: The Missing Element to Building Adaptable Web APIs in Rails
Hypermedia: The Missing Element to Building Adaptable Web APIs in RailsHypermedia: The Missing Element to Building Adaptable Web APIs in Rails
Hypermedia: The Missing Element to Building Adaptable Web APIs in RailsToru Kawamura
 
Getting Started with WordPress JSON REST API
Getting Started with WordPress JSON REST APIGetting Started with WordPress JSON REST API
Getting Started with WordPress JSON REST APIHishikawa Takuro
 
Padrino - the Godfather of Sinatra
Padrino - the Godfather of SinatraPadrino - the Godfather of Sinatra
Padrino - the Godfather of SinatraStoyan Zhekov
 
Software Development with Open Source
Software Development with Open SourceSoftware Development with Open Source
Software Development with Open SourceOpusVL
 
Adobe AEM CQ5 - Developer Introduction
Adobe AEM CQ5 - Developer IntroductionAdobe AEM CQ5 - Developer Introduction
Adobe AEM CQ5 - Developer IntroductionYash Mody
 
RESTful Api practices Rails 3
RESTful Api practices Rails 3RESTful Api practices Rails 3
RESTful Api practices Rails 3Anton Narusberg
 
Perl in the Real World
Perl in the Real WorldPerl in the Real World
Perl in the Real WorldOpusVL
 

What's hot (20)

Transforming WordPress Search and Query Performance with Elasticsearch
Transforming WordPress Search and Query Performance with Elasticsearch Transforming WordPress Search and Query Performance with Elasticsearch
Transforming WordPress Search and Query Performance with Elasticsearch
 
Beyond The Browser - Creating a RESTful Web Service With WordPress
Beyond The Browser - Creating a RESTful Web Service With WordPressBeyond The Browser - Creating a RESTful Web Service With WordPress
Beyond The Browser - Creating a RESTful Web Service With WordPress
 
Modernizing WordPress Search with Elasticsearch
Modernizing WordPress Search with ElasticsearchModernizing WordPress Search with Elasticsearch
Modernizing WordPress Search with Elasticsearch
 
Unlocking the Magical Powers of WP_Query
Unlocking the Magical Powers of WP_QueryUnlocking the Magical Powers of WP_Query
Unlocking the Magical Powers of WP_Query
 
Optimization of modern web applications
Optimization of modern web applicationsOptimization of modern web applications
Optimization of modern web applications
 
ClubAJAX Basics - Server Communication
ClubAJAX Basics - Server CommunicationClubAJAX Basics - Server Communication
ClubAJAX Basics - Server Communication
 
Exciting JavaScript - Part II
Exciting JavaScript - Part IIExciting JavaScript - Part II
Exciting JavaScript - Part II
 
WordPress REST API v2: Overview & Exploring
WordPress REST API v2: Overview & ExploringWordPress REST API v2: Overview & Exploring
WordPress REST API v2: Overview & Exploring
 
Introduction to CQ5
Introduction to CQ5Introduction to CQ5
Introduction to CQ5
 
SenchaCon 2016: LinkRest - Modern RESTful API Framework for Ext JS Apps - Rou...
SenchaCon 2016: LinkRest - Modern RESTful API Framework for Ext JS Apps - Rou...SenchaCon 2016: LinkRest - Modern RESTful API Framework for Ext JS Apps - Rou...
SenchaCon 2016: LinkRest - Modern RESTful API Framework for Ext JS Apps - Rou...
 
Flash And Dom
Flash And DomFlash And Dom
Flash And Dom
 
Hypermedia: The Missing Element to Building Adaptable Web APIs in Rails
Hypermedia: The Missing Element to Building Adaptable Web APIs in RailsHypermedia: The Missing Element to Building Adaptable Web APIs in Rails
Hypermedia: The Missing Element to Building Adaptable Web APIs in Rails
 
Ch. x web performance
Ch. x web performanceCh. x web performance
Ch. x web performance
 
Getting Started with WordPress JSON REST API
Getting Started with WordPress JSON REST APIGetting Started with WordPress JSON REST API
Getting Started with WordPress JSON REST API
 
Padrino - the Godfather of Sinatra
Padrino - the Godfather of SinatraPadrino - the Godfather of Sinatra
Padrino - the Godfather of Sinatra
 
SOA on Rails
SOA on RailsSOA on Rails
SOA on Rails
 
Software Development with Open Source
Software Development with Open SourceSoftware Development with Open Source
Software Development with Open Source
 
Adobe AEM CQ5 - Developer Introduction
Adobe AEM CQ5 - Developer IntroductionAdobe AEM CQ5 - Developer Introduction
Adobe AEM CQ5 - Developer Introduction
 
RESTful Api practices Rails 3
RESTful Api practices Rails 3RESTful Api practices Rails 3
RESTful Api practices Rails 3
 
Perl in the Real World
Perl in the Real WorldPerl in the Real World
Perl in the Real World
 

Viewers also liked

What You Missed in Computer Science
What You Missed in Computer ScienceWhat You Missed in Computer Science
What You Missed in Computer ScienceTaylor Lovett
 
Wordpress search-elasticsearch
Wordpress search-elasticsearchWordpress search-elasticsearch
Wordpress search-elasticsearchTaylor Lovett
 
R programming language
R programming languageR programming language
R programming languageKeerti Verma
 
R programming Basic & Advanced
R programming Basic & AdvancedR programming Basic & Advanced
R programming Basic & AdvancedSohom Ghosh
 
Logging Docker Containers
Logging Docker ContainersLogging Docker Containers
Logging Docker ContainersPavel Vaněček
 
Micro Service Architecture
Micro Service ArchitectureMicro Service Architecture
Micro Service ArchitectureEduards Sizovs
 
Principles of microservices velocity
Principles of microservices   velocityPrinciples of microservices   velocity
Principles of microservices velocitySam Newman
 

Viewers also liked (10)

Fluxible
FluxibleFluxible
Fluxible
 
What You Missed in Computer Science
What You Missed in Computer ScienceWhat You Missed in Computer Science
What You Missed in Computer Science
 
Wordpress search-elasticsearch
Wordpress search-elasticsearchWordpress search-elasticsearch
Wordpress search-elasticsearch
 
R programming language
R programming languageR programming language
R programming language
 
LSESU a Taste of R Language Workshop
LSESU a Taste of R Language WorkshopLSESU a Taste of R Language Workshop
LSESU a Taste of R Language Workshop
 
R programming Basic & Advanced
R programming Basic & AdvancedR programming Basic & Advanced
R programming Basic & Advanced
 
Logging Docker Containers
Logging Docker ContainersLogging Docker Containers
Logging Docker Containers
 
R programming
R programmingR programming
R programming
 
Micro Service Architecture
Micro Service ArchitectureMicro Service Architecture
Micro Service Architecture
 
Principles of microservices velocity
Principles of microservices   velocityPrinciples of microservices   velocity
Principles of microservices velocity
 

Similar to JSON REST API for WordPress

JSON REST API for WordPress
JSON REST API for WordPressJSON REST API for WordPress
JSON REST API for WordPressTaylor Lovett
 
Designing a beautiful REST json api
Designing a beautiful REST json apiDesigning a beautiful REST json api
Designing a beautiful REST json api0x07de
 
WordPress APIs
WordPress APIsWordPress APIs
WordPress APIsmdawaffe
 
The liferay case: lessons learned evolving from RPC to Hypermedia REST APIs
The liferay case: lessons learned evolving from RPC to Hypermedia REST APIsThe liferay case: lessons learned evolving from RPC to Hypermedia REST APIs
The liferay case: lessons learned evolving from RPC to Hypermedia REST APIsJorge Ferrer
 
Finding Restfulness - Madrid.rb April 2014
Finding Restfulness - Madrid.rb April 2014Finding Restfulness - Madrid.rb April 2014
Finding Restfulness - Madrid.rb April 2014samlown
 
Rest in practice
Rest in practiceRest in practice
Rest in practiceIan Brennan
 
Designing RESTful APIs
Designing RESTful APIsDesigning RESTful APIs
Designing RESTful APIsanandology
 
TDC2016POA | Trilha Web - JSON API: não reinvente a roda
TDC2016POA | Trilha Web - JSON API: não reinvente a rodaTDC2016POA | Trilha Web - JSON API: não reinvente a roda
TDC2016POA | Trilha Web - JSON API: não reinvente a rodatdc-globalcode
 
JSON API: Não reinvente a roda
JSON API: Não reinvente a rodaJSON API: Não reinvente a roda
JSON API: Não reinvente a rodaPedro Cavalheiro
 
The Characteristics of a Successful SPA
The Characteristics of a Successful SPAThe Characteristics of a Successful SPA
The Characteristics of a Successful SPAGil Fink
 
Beautiful REST and JSON APIs - Les Hazlewood
Beautiful REST and JSON APIs - Les HazlewoodBeautiful REST and JSON APIs - Les Hazlewood
Beautiful REST and JSON APIs - Les Hazlewoodjaxconf
 
Differential Sync and JSON Patch @ SpringOne2GX 2014
Differential Sync and JSON Patch @ SpringOne2GX 2014Differential Sync and JSON Patch @ SpringOne2GX 2014
Differential Sync and JSON Patch @ SpringOne2GX 2014Brian Cavalier
 
The REST And Then Some
The REST And Then SomeThe REST And Then Some
The REST And Then SomeNordic APIs
 
A REST Layer on Top of the World - IPC13 Munich
A REST Layer on Top of the World - IPC13 MunichA REST Layer on Top of the World - IPC13 Munich
A REST Layer on Top of the World - IPC13 MunichNicolas Pastorino
 
ITB2016 - Building ColdFusion RESTFul Services
ITB2016 - Building ColdFusion RESTFul ServicesITB2016 - Building ColdFusion RESTFul Services
ITB2016 - Building ColdFusion RESTFul ServicesOrtus Solutions, Corp
 
Scaling with swagger
Scaling with swaggerScaling with swagger
Scaling with swaggerTony Tam
 
Maine WordPress Meetup JSON REST API, 3/16/2016
Maine WordPress Meetup JSON REST API, 3/16/2016Maine WordPress Meetup JSON REST API, 3/16/2016
Maine WordPress Meetup JSON REST API, 3/16/2016Andre Gagnon
 
AtlasCamp2014: Introducing the Confluence REST API
AtlasCamp2014: Introducing the Confluence REST APIAtlasCamp2014: Introducing the Confluence REST API
AtlasCamp2014: Introducing the Confluence REST APIAtlassian
 

Similar to JSON REST API for WordPress (20)

JSON REST API for WordPress
JSON REST API for WordPressJSON REST API for WordPress
JSON REST API for WordPress
 
Designing a beautiful REST json api
Designing a beautiful REST json apiDesigning a beautiful REST json api
Designing a beautiful REST json api
 
WordPress APIs
WordPress APIsWordPress APIs
WordPress APIs
 
The liferay case: lessons learned evolving from RPC to Hypermedia REST APIs
The liferay case: lessons learned evolving from RPC to Hypermedia REST APIsThe liferay case: lessons learned evolving from RPC to Hypermedia REST APIs
The liferay case: lessons learned evolving from RPC to Hypermedia REST APIs
 
Web Services
Web ServicesWeb Services
Web Services
 
Soap and Rest
Soap and RestSoap and Rest
Soap and Rest
 
Finding Restfulness - Madrid.rb April 2014
Finding Restfulness - Madrid.rb April 2014Finding Restfulness - Madrid.rb April 2014
Finding Restfulness - Madrid.rb April 2014
 
Rest in practice
Rest in practiceRest in practice
Rest in practice
 
Designing RESTful APIs
Designing RESTful APIsDesigning RESTful APIs
Designing RESTful APIs
 
TDC2016POA | Trilha Web - JSON API: não reinvente a roda
TDC2016POA | Trilha Web - JSON API: não reinvente a rodaTDC2016POA | Trilha Web - JSON API: não reinvente a roda
TDC2016POA | Trilha Web - JSON API: não reinvente a roda
 
JSON API: Não reinvente a roda
JSON API: Não reinvente a rodaJSON API: Não reinvente a roda
JSON API: Não reinvente a roda
 
The Characteristics of a Successful SPA
The Characteristics of a Successful SPAThe Characteristics of a Successful SPA
The Characteristics of a Successful SPA
 
Beautiful REST and JSON APIs - Les Hazlewood
Beautiful REST and JSON APIs - Les HazlewoodBeautiful REST and JSON APIs - Les Hazlewood
Beautiful REST and JSON APIs - Les Hazlewood
 
Differential Sync and JSON Patch @ SpringOne2GX 2014
Differential Sync and JSON Patch @ SpringOne2GX 2014Differential Sync and JSON Patch @ SpringOne2GX 2014
Differential Sync and JSON Patch @ SpringOne2GX 2014
 
The REST And Then Some
The REST And Then SomeThe REST And Then Some
The REST And Then Some
 
A REST Layer on Top of the World - IPC13 Munich
A REST Layer on Top of the World - IPC13 MunichA REST Layer on Top of the World - IPC13 Munich
A REST Layer on Top of the World - IPC13 Munich
 
ITB2016 - Building ColdFusion RESTFul Services
ITB2016 - Building ColdFusion RESTFul ServicesITB2016 - Building ColdFusion RESTFul Services
ITB2016 - Building ColdFusion RESTFul Services
 
Scaling with swagger
Scaling with swaggerScaling with swagger
Scaling with swagger
 
Maine WordPress Meetup JSON REST API, 3/16/2016
Maine WordPress Meetup JSON REST API, 3/16/2016Maine WordPress Meetup JSON REST API, 3/16/2016
Maine WordPress Meetup JSON REST API, 3/16/2016
 
AtlasCamp2014: Introducing the Confluence REST API
AtlasCamp2014: Introducing the Confluence REST APIAtlasCamp2014: Introducing the Confluence REST API
AtlasCamp2014: Introducing the Confluence REST API
 

Recently uploaded

Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostZilliz
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsMiki Katsuragi
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Scott Keck-Warren
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machinePadma Pradeep
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piececharlottematthew16
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxhariprasad279825
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenHervé Boutemy
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clashcharlottematthew16
 

Recently uploaded (20)

Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering Tips
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptxE-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piece
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptx
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clash
 

JSON REST API for WordPress

  • 1. JSON REST API for WordPress @tlovett12 + JSON REST API =
  • 2. Who Am I? • My name is Taylor Lovett! • Director of Web Engineering at 10up • Open source community member • WordPress core contributor • WP API team member @tlovett12
  • 3. We are hiring! @tlovett12
  • 4. So what’s this new WordPress API thing all about? Don’t we already have one?
  • 5. Right now, we have XML-RPC. Remote Procedural Call API’s are part of an old standard. They are very difficult to use.
  • 6. Why JSON REST API? • In a nutshell, JSON REST API’s have swept the web becoming an almost standard. They are extremely intuitive and provide an easy way to distribute, collect, and modify data. Let’s break it down a bit.
  • 7. JSON • JSON is an abbreviation for “JavaScript Object Notation” • It’s simply a way to describe data that is lightweight and extremely easy to use. Arguably much easier to use than XML.
  • 8. REST • REST (Representational State Transfer) is an architectural style that dictates how HTTP and URI’s should be used and organized. • Verbs and resources: GET /post/1 • Hypermedia as the Engine of Application State (HATEOAS) - Server provides everything you need to know how to use it in a response. • Actions are autonomous and do not depend on each other. • Bottom line: RESTful API’s have become extremely popular across the web. They are much easier to use than things like RPC or SOAP.
  • 9. And of course, API • An API (Application Programming Interface) is a set of entry points that allow you to interact with a platform (WordPress in this case).
  • 10. How can I start using it now?
  • 11. First, install the plugin http://wordpress.org/plugins/json-rest-api/ ! Core integration coming soon.
  • 12. What does the API let me to do? /wp-json/ Shows all the routes and endpoints available /wp-json/posts Create, read, update, and delete posts /wp-json/users Create, read, update, and delete users /wp-json/media Create, read, update, and delete media items /wp-json/taxonomies Read taxonomies and terms /wp-json/pages/ Create, read, update, and delete pages
  • 13. The API is rich with functionality. Explore the documentation! http://wp-api.org
  • 14. The basic building block of WordPress is the post. http://codex.wordpress.org/Writing_Posts
  • 15. List Posts [{! "ID": 11297,! "title": "Post 19",! "status": "publish",! "type": "post",! "author": 1,! "content": "",! "parent": null,! "link": "http://example.com/2014/08/post-19/",! "format": "standard",! "slug": "post-19",! "guid": "http://example.com/2014/08/post-19/",! "excerpt": null,! "menu_order": 0,! "comment_status": "closed",! "ping_status": "open",! "sticky": false,! "meta": {},! "featured_image": null,! "terms": {}! }] GET /wp-json/posts
  • 16. List Posts GET /wp-json/posts Takes a number of useful parameters: • Filter[]: Accepts WP_Query arguments http://codex.wordpress.org/Class_Reference/WP_Query • Page: Allows for pagination • Context: Determines usage context i.e. “view or edit” • … https://github.com/WP-API/WP-API/blob/master/docs/routes/routes.md
  • 17. Retrieve A Post {! "ID": 11297,! "title": "Post 19",! "status": "publish",! "type": "post",! "author": 1,! "content": "",! "parent": null,! "link": "http://example.com/2014/08/post-19/",! "format": "standard",! "slug": "post-19",! "guid": "http://example.com/2014/08/post-19/",! "excerpt": null,! "menu_order": 0,! "comment_status": "closed",! "ping_status": "open",! "sticky": false,! "meta": {},! "featured_image": null,! "terms": {}! } GET /wp-json/posts/<id>
  • 18. Edit A Post PUT /wp-json/posts/<id> curl -X PUT -H “Content-Type: application/json” -d ‘! {! "title": “Updated Title",! “content_raw": “Updated post content"! }! ‘ -u admin:password http://example.com/wp-json/posts/<id> We need to send a PUT request to this endpoint with our post data. Of course we must authenticate before doing this.
  • 19. Create A Post POST /wp-json/posts/ curl -X POST -H “Content-Type: application/json” -d ‘! {! "title": “Title",! “content_raw": “Post content"! }! ‘ -u admin:password http://example.com/wp-json/posts/ Notice we are using a POST request this time.
  • 20. Build Your Own Routes and Endpoints WP API is very extensible http://wp-api.org/guides/extending.html
  • 21. What can I do with the JSON REST API for WordPress?
  • 23. If you learned nothing so far, know this: You can do amazing things with the JSON REST API for WordPress. Soon ~23% of the web will be using this API.
  • 24. Questions? @tlovett12! taylor.lovett@10up.com! taylorlovett.com We need to send a PUT request to this endpoint with our post data. Of course we must authenticate before doing this.