SlideShare a Scribd company logo
1 of 16
Download to read offline
WP REST API:
Adding Your Own Endpoint
Keanan Koppenhaver
http://levelupwp.net
https://www.facebook.com/levelupwp
http://github.com/kkoppenhaver
Who Am I?
• WordPress Developer at doejo for 3 years
• Worked on WP sites large (XX,XXX posts) and
small (5 simple pages)
• Have recently been using just pieces of the
WP REST API in production
Why are we here today?
• Learn a little about the WP REST API
• See some real world examples
• Learn which pieces of the API are available in
core
• Learn how to create our own endpoint
Questions?
Ask them anytime in the chat box below.
How did the REST API
come about?
• Proposed just after the WP Community Summit in
2012
• JSON over XML because of how it maps to
programming language constructs
• REST because the REST paradigm matches up
well with the CMS structure
• Merged* into Core on October 8, 2015 

(https://core.trac.wordpress.org/changeset/34928)
Source: https://youtu.be/tV4IuS_KnvU?t=19m24s
WP REST API in the wild
• ustwo.com
• WP Live Search
• A “Digital Newspaper” with the WP API
• WP Powered Mobile Apps
• Any many more…
Demo: ustwo.com
Demo: ustwo on Github
Is the WP REST API part of
WP Core?
• Yes*
• Infrastructure is in core
• Prebuilt endpoints aren’t in core
• We can create our own endpoints without an
additional plugin
• If we want all the endpoints we need a plugin
What does the plugin give us?
• Endpoints on posts, pages, revisions, media,
post types, post statuses, comments,
taxonomies, categories, tags and users
• Can be enabled for CPT or custom taxonomy
• For a full list, see the reference
And without the plugin?
• No endpoints available, but they can be
created
• Step 1: Create a function to return the
necessary data
• Step 2: Register with register_rest_route
• Step 3: Flush Rewrite Rules
• Step 4: Profit!
Step 1
Create a function to return the necessary data
Step 2
Register with register_rest_route
Step 3
Flush Rewrite Rules
Step 4
Profit!
Q&A
Keanan Koppenhaver
http://levelupwp.net
https://www.facebook.com/levelupwp
http://github.com/kkoppenhaver

More Related Content

What's hot

Versioning strategy for a complex internal API (Konstantin Yakushev)
Versioning strategy for a complex internal API (Konstantin Yakushev)Versioning strategy for a complex internal API (Konstantin Yakushev)
Versioning strategy for a complex internal API (Konstantin Yakushev)Nordic APIs
 
Postman Webinar: Postman 101
Postman Webinar: Postman 101Postman Webinar: Postman 101
Postman Webinar: Postman 101Nikita Sharma
 
Space Camp :: Introduction to API Security
Space Camp :: Introduction to API SecuritySpace Camp :: Introduction to API Security
Space Camp :: Introduction to API SecurityPostman
 
Neotys PAC 2018 - Wilson Mar
Neotys PAC 2018 - Wilson MarNeotys PAC 2018 - Wilson Mar
Neotys PAC 2018 - Wilson MarNeotys_Partner
 
Accelerate Quality with Postman - Basics
Accelerate Quality with Postman - BasicsAccelerate Quality with Postman - Basics
Accelerate Quality with Postman - BasicsKnoldus Inc.
 
Londons Calling 2021
Londons Calling 2021Londons Calling 2021
Londons Calling 2021Keir Bowden
 
Migrate PHP E-Commerce Site to Go
Migrate PHP E-Commerce Site to GoMigrate PHP E-Commerce Site to Go
Migrate PHP E-Commerce Site to GoWeng Wei
 
It Takes a Village to Make WordPress
It Takes a Village to Make WordPressIt Takes a Village to Make WordPress
It Takes a Village to Make WordPressDrewAPicture
 
JavaScript Build System Battle Royale | PrDC 2017
JavaScript Build System Battle Royale | PrDC 2017JavaScript Build System Battle Royale | PrDC 2017
JavaScript Build System Battle Royale | PrDC 2017David Wesst
 
Story Testing Approach for Enterprise Applications using Selenium Framework
Story Testing Approach for Enterprise Applications using Selenium FrameworkStory Testing Approach for Enterprise Applications using Selenium Framework
Story Testing Approach for Enterprise Applications using Selenium FrameworkOleksiy Rezchykov
 
Austin Elixir: Slack Bots With Hedwig
Austin Elixir: Slack Bots With HedwigAustin Elixir: Slack Bots With Hedwig
Austin Elixir: Slack Bots With Hedwigedebill
 
Super tools to boost productivity in React dev env!
Super tools to boost productivity in React dev env!Super tools to boost productivity in React dev env!
Super tools to boost productivity in React dev env!Souvik Basu
 
POST/CON Keynote 2019
POST/CON Keynote 2019POST/CON Keynote 2019
POST/CON Keynote 2019Postman
 
How to Supercharge your PHP Web API
How to Supercharge your PHP Web APIHow to Supercharge your PHP Web API
How to Supercharge your PHP Web APIAurimas Niekis
 
Postman: An Introduction for Testers
Postman: An Introduction for TestersPostman: An Introduction for Testers
Postman: An Introduction for TestersPostman
 
DevNet 1056 WIT Spark API and Chat Bot Workshop
DevNet 1056 WIT Spark API and Chat Bot WorkshopDevNet 1056 WIT Spark API and Chat Bot Workshop
DevNet 1056 WIT Spark API and Chat Bot WorkshopTessa Mero
 
Design & Prototype an API
Design & Prototype an APIDesign & Prototype an API
Design & Prototype an APIPostman
 

What's hot (19)

Versioning strategy for a complex internal API (Konstantin Yakushev)
Versioning strategy for a complex internal API (Konstantin Yakushev)Versioning strategy for a complex internal API (Konstantin Yakushev)
Versioning strategy for a complex internal API (Konstantin Yakushev)
 
Postman Webinar: Postman 101
Postman Webinar: Postman 101Postman Webinar: Postman 101
Postman Webinar: Postman 101
 
Space Camp :: Introduction to API Security
Space Camp :: Introduction to API SecuritySpace Camp :: Introduction to API Security
Space Camp :: Introduction to API Security
 
Neotys PAC 2018 - Wilson Mar
Neotys PAC 2018 - Wilson MarNeotys PAC 2018 - Wilson Mar
Neotys PAC 2018 - Wilson Mar
 
Accelerate Quality with Postman - Basics
Accelerate Quality with Postman - BasicsAccelerate Quality with Postman - Basics
Accelerate Quality with Postman - Basics
 
Londons Calling 2021
Londons Calling 2021Londons Calling 2021
Londons Calling 2021
 
Build social apps for Facebook
Build social apps for FacebookBuild social apps for Facebook
Build social apps for Facebook
 
Migrate PHP E-Commerce Site to Go
Migrate PHP E-Commerce Site to GoMigrate PHP E-Commerce Site to Go
Migrate PHP E-Commerce Site to Go
 
It Takes a Village to Make WordPress
It Takes a Village to Make WordPressIt Takes a Village to Make WordPress
It Takes a Village to Make WordPress
 
JavaScript Build System Battle Royale | PrDC 2017
JavaScript Build System Battle Royale | PrDC 2017JavaScript Build System Battle Royale | PrDC 2017
JavaScript Build System Battle Royale | PrDC 2017
 
Story Testing Approach for Enterprise Applications using Selenium Framework
Story Testing Approach for Enterprise Applications using Selenium FrameworkStory Testing Approach for Enterprise Applications using Selenium Framework
Story Testing Approach for Enterprise Applications using Selenium Framework
 
WordPress 4.1
WordPress 4.1WordPress 4.1
WordPress 4.1
 
Austin Elixir: Slack Bots With Hedwig
Austin Elixir: Slack Bots With HedwigAustin Elixir: Slack Bots With Hedwig
Austin Elixir: Slack Bots With Hedwig
 
Super tools to boost productivity in React dev env!
Super tools to boost productivity in React dev env!Super tools to boost productivity in React dev env!
Super tools to boost productivity in React dev env!
 
POST/CON Keynote 2019
POST/CON Keynote 2019POST/CON Keynote 2019
POST/CON Keynote 2019
 
How to Supercharge your PHP Web API
How to Supercharge your PHP Web APIHow to Supercharge your PHP Web API
How to Supercharge your PHP Web API
 
Postman: An Introduction for Testers
Postman: An Introduction for TestersPostman: An Introduction for Testers
Postman: An Introduction for Testers
 
DevNet 1056 WIT Spark API and Chat Bot Workshop
DevNet 1056 WIT Spark API and Chat Bot WorkshopDevNet 1056 WIT Spark API and Chat Bot Workshop
DevNet 1056 WIT Spark API and Chat Bot Workshop
 
Design & Prototype an API
Design & Prototype an APIDesign & Prototype an API
Design & Prototype an API
 

Viewers also liked

RESTFul API Design and Documentation - an Introduction
RESTFul API Design and Documentation - an IntroductionRESTFul API Design and Documentation - an Introduction
RESTFul API Design and Documentation - an IntroductionMiredot
 
API Design Essentials - Akana Platform Overview
API Design Essentials - Akana Platform OverviewAPI Design Essentials - Akana Platform Overview
API Design Essentials - Akana Platform OverviewAkana
 
Building a REST API for Longevity
Building a REST API for LongevityBuilding a REST API for Longevity
Building a REST API for LongevityMuleSoft
 
Deep-dive into Microservice Outer Architecture
Deep-dive into Microservice Outer ArchitectureDeep-dive into Microservice Outer Architecture
Deep-dive into Microservice Outer ArchitectureWSO2
 
Beautiful REST+JSON APIs with Ion
Beautiful REST+JSON APIs with IonBeautiful REST+JSON APIs with Ion
Beautiful REST+JSON APIs with IonStormpath
 
Building Beautiful REST APIs with ASP.NET Core
Building Beautiful REST APIs with ASP.NET CoreBuilding Beautiful REST APIs with ASP.NET Core
Building Beautiful REST APIs with ASP.NET CoreStormpath
 

Viewers also liked (7)

RESTFul API Design and Documentation - an Introduction
RESTFul API Design and Documentation - an IntroductionRESTFul API Design and Documentation - an Introduction
RESTFul API Design and Documentation - an Introduction
 
API Design Essentials - Akana Platform Overview
API Design Essentials - Akana Platform OverviewAPI Design Essentials - Akana Platform Overview
API Design Essentials - Akana Platform Overview
 
Building a REST API for Longevity
Building a REST API for LongevityBuilding a REST API for Longevity
Building a REST API for Longevity
 
Deep-dive into Microservice Outer Architecture
Deep-dive into Microservice Outer ArchitectureDeep-dive into Microservice Outer Architecture
Deep-dive into Microservice Outer Architecture
 
Beautiful REST+JSON APIs with Ion
Beautiful REST+JSON APIs with IonBeautiful REST+JSON APIs with Ion
Beautiful REST+JSON APIs with Ion
 
Building Beautiful REST APIs with ASP.NET Core
Building Beautiful REST APIs with ASP.NET CoreBuilding Beautiful REST APIs with ASP.NET Core
Building Beautiful REST APIs with ASP.NET Core
 
RESTful API Design, Second Edition
RESTful API Design, Second EditionRESTful API Design, Second Edition
RESTful API Design, Second Edition
 

Similar to WP REST API - Adding Your Own Endpoint

REST In Action: The Live Coverage Platform at the New York Times
REST In Action: The Live Coverage Platform at the New York TimesREST In Action: The Live Coverage Platform at the New York Times
REST In Action: The Live Coverage Platform at the New York TimesScott Taylor
 
WordPress Rest API
WordPress Rest APIWordPress Rest API
WordPress Rest APIBrian Layman
 
STC Summit 2015: API Documentation, an Example-Based Approach
STC Summit 2015: API Documentation, an Example-Based ApproachSTC Summit 2015: API Documentation, an Example-Based Approach
STC Summit 2015: API Documentation, an Example-Based ApproachLois Patterson
 
2015 WordCamp Maine Keynote
2015 WordCamp Maine Keynote2015 WordCamp Maine Keynote
2015 WordCamp Maine KeynoteScott Taylor
 
Live Coverage at The New York Times
Live Coverage at The New York TimesLive Coverage at The New York Times
Live Coverage at The New York TimesScott Taylor
 
Why & How to Create a WordPress Plugin
Why & How to Create a WordPress PluginWhy & How to Create a WordPress Plugin
Why & How to Create a WordPress PluginJoe Querin
 
WooCommerce & Apple TV
WooCommerce & Apple TVWooCommerce & Apple TV
WooCommerce & Apple TVMarko Heijnen
 
WordPress 4.4 and Beyond
WordPress 4.4 and BeyondWordPress 4.4 and Beyond
WordPress 4.4 and BeyondScott Taylor
 
The WordPress REST API as a Springboard for Website Greatness
The WordPress REST API as a Springboard for Website GreatnessThe WordPress REST API as a Springboard for Website Greatness
The WordPress REST API as a Springboard for Website GreatnessWP Engine UK
 
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
 
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
 
Cross CMS plugin development using AWF
Cross CMS plugin development using AWFCross CMS plugin development using AWF
Cross CMS plugin development using AWFTim Plummer
 
Building a mobile app connected to WordPress with WP-AppKit
Building a mobile app connected to WordPress with WP-AppKitBuilding a mobile app connected to WordPress with WP-AppKit
Building a mobile app connected to WordPress with WP-AppKitBenjamin LUPU
 
Decoupled Architecture and WordPress
Decoupled Architecture and WordPressDecoupled Architecture and WordPress
Decoupled Architecture and WordPressPantheon
 
Untangling spring week11
Untangling spring week11Untangling spring week11
Untangling spring week11Derek Jacoby
 
SV.CO’s iterative product development
SV.CO’s iterative product developmentSV.CO’s iterative product development
SV.CO’s iterative product developmenthari
 
Experience Session - Hari
Experience Session - HariExperience Session - Hari
Experience Session - HariSV.CO
 
Bringing Dev and Ops together with ChatOps
Bringing Dev and Ops together with ChatOpsBringing Dev and Ops together with ChatOps
Bringing Dev and Ops together with ChatOpsJaap Brasser
 
How to build a Project Hub with Hubsites and Sitedesign and Sitescripts
How to build a Project Hub with Hubsites and Sitedesign and Sitescripts How to build a Project Hub with Hubsites and Sitedesign and Sitescripts
How to build a Project Hub with Hubsites and Sitedesign and Sitescripts Knut Relbe-Moe [MVP, MCT]
 

Similar to WP REST API - Adding Your Own Endpoint (20)

REST In Action: The Live Coverage Platform at the New York Times
REST In Action: The Live Coverage Platform at the New York TimesREST In Action: The Live Coverage Platform at the New York Times
REST In Action: The Live Coverage Platform at the New York Times
 
WordPress Rest API
WordPress Rest APIWordPress Rest API
WordPress Rest API
 
STC Summit 2015: API Documentation, an Example-Based Approach
STC Summit 2015: API Documentation, an Example-Based ApproachSTC Summit 2015: API Documentation, an Example-Based Approach
STC Summit 2015: API Documentation, an Example-Based Approach
 
A Day of REST
A Day of RESTA Day of REST
A Day of REST
 
2015 WordCamp Maine Keynote
2015 WordCamp Maine Keynote2015 WordCamp Maine Keynote
2015 WordCamp Maine Keynote
 
Live Coverage at The New York Times
Live Coverage at The New York TimesLive Coverage at The New York Times
Live Coverage at The New York Times
 
Why & How to Create a WordPress Plugin
Why & How to Create a WordPress PluginWhy & How to Create a WordPress Plugin
Why & How to Create a WordPress Plugin
 
WooCommerce & Apple TV
WooCommerce & Apple TVWooCommerce & Apple TV
WooCommerce & Apple TV
 
WordPress 4.4 and Beyond
WordPress 4.4 and BeyondWordPress 4.4 and Beyond
WordPress 4.4 and Beyond
 
The WordPress REST API as a Springboard for Website Greatness
The WordPress REST API as a Springboard for Website GreatnessThe WordPress REST API as a Springboard for Website Greatness
The WordPress REST API as a Springboard for Website Greatness
 
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
 
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
 
Cross CMS plugin development using AWF
Cross CMS plugin development using AWFCross CMS plugin development using AWF
Cross CMS plugin development using AWF
 
Building a mobile app connected to WordPress with WP-AppKit
Building a mobile app connected to WordPress with WP-AppKitBuilding a mobile app connected to WordPress with WP-AppKit
Building a mobile app connected to WordPress with WP-AppKit
 
Decoupled Architecture and WordPress
Decoupled Architecture and WordPressDecoupled Architecture and WordPress
Decoupled Architecture and WordPress
 
Untangling spring week11
Untangling spring week11Untangling spring week11
Untangling spring week11
 
SV.CO’s iterative product development
SV.CO’s iterative product developmentSV.CO’s iterative product development
SV.CO’s iterative product development
 
Experience Session - Hari
Experience Session - HariExperience Session - Hari
Experience Session - Hari
 
Bringing Dev and Ops together with ChatOps
Bringing Dev and Ops together with ChatOpsBringing Dev and Ops together with ChatOps
Bringing Dev and Ops together with ChatOps
 
How to build a Project Hub with Hubsites and Sitedesign and Sitescripts
How to build a Project Hub with Hubsites and Sitedesign and Sitescripts How to build a Project Hub with Hubsites and Sitedesign and Sitescripts
How to build a Project Hub with Hubsites and Sitedesign and Sitescripts
 

More from Keanan Koppenhaver

The WP REST API as the Foundation of the Open Web 
The WP REST API as the Foundation of the Open Web The WP REST API as the Foundation of the Open Web 
The WP REST API as the Foundation of the Open Web Keanan Koppenhaver
 
Voice is the New Keyboard - Voice Interfaces in 2018 and Beyond
Voice is the New Keyboard - Voice Interfaces in 2018 and BeyondVoice is the New Keyboard - Voice Interfaces in 2018 and Beyond
Voice is the New Keyboard - Voice Interfaces in 2018 and BeyondKeanan Koppenhaver
 
Selling DevOps To Non-Technical Management
Selling DevOps To Non-Technical ManagementSelling DevOps To Non-Technical Management
Selling DevOps To Non-Technical ManagementKeanan Koppenhaver
 
Contributing to WordPress - #WCNYC
Contributing to WordPress  - #WCNYCContributing to WordPress  - #WCNYC
Contributing to WordPress - #WCNYCKeanan Koppenhaver
 
Contributing to open source as a non developer - #wclax
Contributing to open source as a non developer - #wclaxContributing to open source as a non developer - #wclax
Contributing to open source as a non developer - #wclaxKeanan Koppenhaver
 
WordPress Debugging Tips and Tricks
WordPress Debugging Tips and TricksWordPress Debugging Tips and Tricks
WordPress Debugging Tips and TricksKeanan Koppenhaver
 
WordPress Debugging Tips and Tricks
WordPress Debugging Tips and TricksWordPress Debugging Tips and Tricks
WordPress Debugging Tips and TricksKeanan Koppenhaver
 
Your WordPress Site Has Been Hacked: What Now?
Your WordPress Site Has Been Hacked: What Now?Your WordPress Site Has Been Hacked: What Now?
Your WordPress Site Has Been Hacked: What Now?Keanan Koppenhaver
 

More from Keanan Koppenhaver (13)

The WP REST API as the Foundation of the Open Web 
The WP REST API as the Foundation of the Open Web The WP REST API as the Foundation of the Open Web 
The WP REST API as the Foundation of the Open Web 
 
Advanced WordPress Tooling
Advanced WordPress ToolingAdvanced WordPress Tooling
Advanced WordPress Tooling
 
Voice is the New Keyboard - Voice Interfaces in 2018 and Beyond
Voice is the New Keyboard - Voice Interfaces in 2018 and BeyondVoice is the New Keyboard - Voice Interfaces in 2018 and Beyond
Voice is the New Keyboard - Voice Interfaces in 2018 and Beyond
 
Selling DevOps To Non-Technical Management
Selling DevOps To Non-Technical ManagementSelling DevOps To Non-Technical Management
Selling DevOps To Non-Technical Management
 
Debugging Tips and Tricks
Debugging Tips and TricksDebugging Tips and Tricks
Debugging Tips and Tricks
 
Contributing to WordPress - #WCNYC
Contributing to WordPress  - #WCNYCContributing to WordPress  - #WCNYC
Contributing to WordPress - #WCNYC
 
Contributing to open source as a non developer - #wclax
Contributing to open source as a non developer - #wclaxContributing to open source as a non developer - #wclax
Contributing to open source as a non developer - #wclax
 
Building a WordPress plugin
Building a WordPress pluginBuilding a WordPress plugin
Building a WordPress plugin
 
WordPress Debugging Tips and Tricks
WordPress Debugging Tips and TricksWordPress Debugging Tips and Tricks
WordPress Debugging Tips and Tricks
 
WordPress Debugging Tips and Tricks
WordPress Debugging Tips and TricksWordPress Debugging Tips and Tricks
WordPress Debugging Tips and Tricks
 
Your WordPress Site Has Been Hacked: What Now?
Your WordPress Site Has Been Hacked: What Now?Your WordPress Site Has Been Hacked: What Now?
Your WordPress Site Has Been Hacked: What Now?
 
Enterprise-Scale WordPress
Enterprise-Scale WordPressEnterprise-Scale WordPress
Enterprise-Scale WordPress
 
routrr
routrrroutrr
routrr
 

Recently uploaded

Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...shyamraj55
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Paola De la Torre
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhisoniya singh
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsMemoori
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxOnBoard
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksSoftradix Technologies
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 3652toLead Limited
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 

Recently uploaded (20)

Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping Elbows
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptx
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other Frameworks
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 

WP REST API - Adding Your Own Endpoint

  • 1. WP REST API: Adding Your Own Endpoint Keanan Koppenhaver http://levelupwp.net https://www.facebook.com/levelupwp http://github.com/kkoppenhaver
  • 2. Who Am I? • WordPress Developer at doejo for 3 years • Worked on WP sites large (XX,XXX posts) and small (5 simple pages) • Have recently been using just pieces of the WP REST API in production
  • 3. Why are we here today? • Learn a little about the WP REST API • See some real world examples • Learn which pieces of the API are available in core • Learn how to create our own endpoint
  • 4. Questions? Ask them anytime in the chat box below.
  • 5. How did the REST API come about? • Proposed just after the WP Community Summit in 2012 • JSON over XML because of how it maps to programming language constructs • REST because the REST paradigm matches up well with the CMS structure • Merged* into Core on October 8, 2015 
 (https://core.trac.wordpress.org/changeset/34928) Source: https://youtu.be/tV4IuS_KnvU?t=19m24s
  • 6. WP REST API in the wild • ustwo.com • WP Live Search • A “Digital Newspaper” with the WP API • WP Powered Mobile Apps • Any many more…
  • 8. Demo: ustwo on Github
  • 9. Is the WP REST API part of WP Core? • Yes* • Infrastructure is in core • Prebuilt endpoints aren’t in core • We can create our own endpoints without an additional plugin • If we want all the endpoints we need a plugin
  • 10. What does the plugin give us? • Endpoints on posts, pages, revisions, media, post types, post statuses, comments, taxonomies, categories, tags and users • Can be enabled for CPT or custom taxonomy • For a full list, see the reference
  • 11. And without the plugin? • No endpoints available, but they can be created • Step 1: Create a function to return the necessary data • Step 2: Register with register_rest_route • Step 3: Flush Rewrite Rules • Step 4: Profit!
  • 12. Step 1 Create a function to return the necessary data
  • 13. Step 2 Register with register_rest_route