At my new job, I have been adding lots of new Custom Post Types for tracking data. A big one is a new Web App written in jQuery Mobile for managing reservations on collaboration rooms in our library. Next to the door of each room is an iPad mounted to the wall that shows the status of that room. It allows library patrons to check in for their reservation and make future reservations.
All of the reservation data is stored on a WordPress site with forms built with Advanced Custom Fields Pro. The web app makes calls to the data site and gets the data it needs back as JSON.
I wanted to do all of the “work” on the WordPress site, and simply accessing the data stored in the Custom Post Types would mean the web app would have to do a lot of calculations with the raw data returned. So, I extended the WordPress REST API to include my own endpoints where my code could do all the dirty work and simply return the results back to the web app.
I’ll go into more details in another post, but I wanted to share links to the articles that helped me figure out how to add my REST API extensions.
Adding New Endpoints (official REST API documentation)
Register_Rest_Route() Developer Documentation
How to: create a custom endpoint with the core REST API in WordPress
WP API: Adding Custom Endpoints