The WordPress REST API is more than just a set of default routes. It is also a tool for creating custom routes and endpoints. In this session, you'll learn how to create custom routes and endpoints, and test them using Postman.
2. 2
👋🏽
Welcome!
As you join, please make sure you have your local
development environment ready:
• A local WordPress installation
• A code editor like VSCode or Sublime
• Postman
https://www.postman.com/downloads/
Then, let everyone know in the chat where you’re
joining us from, and something interesting about your
city/state/country…
Hello!
○ My name is Jonathan Bossenger
○ From Cape Town, South Africa
○ Ex-developer turned code instructor
○ Sponsored contributor at Automattic
○ jonathanbossenger.com
4. Announcements
○ Welcome, and thank you to Joshua for co-hosting!
○ We are presenting in focus mode, but please feel free to enable your video.
○ Please let me know if you can’t see my shared screen.
○ You are welcome to ask questions.
○ You are welcome to post questions in the chat, or unmute to ask questions.
5. Announcements
○ Make sure your local install is ready
• https://www.postman.com/downloads/
○ If I am going too fast, please let me know!
○ We will be posting this session to https://wordpress.tv/ afterwards
○ For more WordPress focused content please visit https://learn.wordpress.org/
○ Follow up questions/feedback - https://github.com/WordPress/Learn/issues/1304
6. Learning Outcomes
1. Registering a custom WP REST API route
2. Registering different route endpoints
3. How to access WP REST API request data in your custom route
4. Protecting routes/requiring authentication
5. Adding and using path variables on routes
7. Objectives
1. Create a form submissions REST API plugin
2. Create a custom table to store form submissions
3. Register a custom WP REST API route to fetch submissions
4. Register a custom WP REST API route to post submissions
5. Register a custom WP REST API endpoint to fetch a single submission
7