Using REST API

Using the WordPress REST-API you can create a plugin to provide entirely new admin experiences for WordPress, build a brand new interactive front-end experience, or bring your WordPress content into completely separate applications.

There are 5 main key concepts of REST API that you should know before starting using it.

  • Routes & Endpoints – A route is a URI that can be mapped to different HTTP methods. The mapping of an individual HTTP method to a route is known as an endpoint.
  • Requests – A request made in WordPress is an instance of WP_REST_Request class, which is used to store and retrieve information for the current request.
  • Responses – Responses are the data you get back from the API. The WP_REST_Response class provides a way to interact with the response data returned by endpoints. 
  • Schema – API Schema is a data structure of input and output data of each endpoint.
  • Controller Classes. – It manages the registration of routes & endpoints, handling requests, utilizing schema, and generating API responses.

You can find more details on these concepts here. Also refer to the Glossary handbook page.

Learn more about how to interact with API resources and query for specific data in the Using the REST API section. Also, refer to the Endpoint Reference handbook page to know all the default endpoints provided by WordPress.

Explore these videos for insights and tutorials on REST API. This section comprises 4 modules with a combined duration of 31 minutes.

Video ContentTime
Introduction to REST API09:35
Parameters 09:59
More on REST API & Discovery 04:33
Authentication & Endpoints on Custom Post Types09:07