Ever wanted to convert that awesome, but complex web or mobile app idea into something that actually works, but just didn’t have the necessary backend coding skills to make it happen. WordPress Rest API can help make your app ideas a reality, because it lets you access, display and edit the data in the database of a WordPress site, without admin credentials or directly interacting with the WordPress user interface itself. This means we can now build apps in any way, shape or form, by using WordPress as the backend engine of our custom apps.
What is an API
Every major social media platform and many online services, provide API’s which are basically routines, protocols, and tools for building our own applications and user interface designs, by using data pulled in from those respective online platforms. REST or Representational State Transfer, uses the standard verbs GET, POST, PUT and DELETE, to retrieve and send data to and from a remote server, using Uniform Resource Identifiers (URI’s), to interact with that remote server. WordPress REST API is a RESTful API that uses simple Hypertext Transfer Protocol (HTTP) or Uniform Resource Locator (URL) requests, to access the data and perform operations on a WordPress backend. The most important takeaway from this is that the WordPress REST API provides a uniform, standardized data output from WordPress, which means we can use that output to build applications in any programming language.
Accessing the API
Interacting with the WordPress REST API requires accessing the available Endpoints via Routes which are the names given for the URI’s. The Endpoints are specific functions performed using one or more of the methods GET, POST, PUT and DELETE, in other words it is the actions performed on the URI’s. An example of this, would be to get the contents of a specific post in the WordPress backend, say the post with an ID of 125, which would be accessed with the GET endpoint, via its unique URI or Route. If the necessary authentication and privileges are in place, then additional endpoints such as PUT and DELETE will also be available at the same Route.