0% found this document useful (0 votes)
8 views1 page

Understanding WordPress REST API Endpoints

The document explains the concepts of routes and endpoints in the context of interacting with a WordPress REST API. An endpoint is a function that performs specific actions on a URI, while a route is the URI used to access these endpoints. The document provides an example of retrieving a post by its ID and mentions additional endpoints for updating and deleting data.

Uploaded by

ilias ahmed
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views1 page

Understanding WordPress REST API Endpoints

The document explains the concepts of routes and endpoints in the context of interacting with a WordPress REST API. An endpoint is a function that performs specific actions on a URI, while a route is the URI used to access these endpoints. The document provides an example of retrieving a post by its ID and mentions additional endpoints for updating and deleting data.

Uploaded by

ilias ahmed
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

- [Instructor] Interacting with a WordPress REST API is done through accessing

what's known as routes and endpoints. These are two are connected terms that are
used together, so they should also be explained together. An endpoint is a function
available through the API, so the verbs I mentioned in the REST definition. An
endpoint performs a specific function by taking one or more arguments and returning
the resulting data. A route or route is a name or address you use to access the
available endpoints, in our case, a URI. So in short, the route is the URI, the
endpoint is the action performed on that URI. This all makes a lot more sense if we
look at a practical example. Let's say I want to get the contents of a specific post
from WordPress with the post ID 456. I can achieve this by using the GET
endpoint at the wp/v2/posts/456 route. This endpoint retrieves the data from the
database entry with the ID 456 and returns it to me as a JSON object. Now, if I have
the correct authentication in place, meaning a username and a password and the
correct privileges, this same route also has two additional endpoints, PUT, which
grabs the existing data, then takes whatever I put into it and updates the data and
then returns it to me, and DELETE, which goes in and deletes the data entry from
the server entirely. The WordPress REST API provides a long list of routes and
different routes have different endpoints and different arguments. Later in the course
we'll explore some of the more common ones and I'll explain how to discover and
use all of them, so you have the full REST API at your disposal.

You might also like