Professional Documents
Culture Documents
An Introduction To WordPress Rest API
An Introduction To WordPress Rest API
Prakash Singh
Wordpress Developer
The WP API is a RESTful API that can be accessed through simple HTTP
request to access the site data in JSON format.
The WP API is a new way of accessing the data WordPress provides without
having to go through a theme,RSS feed, or XML RPC.
Resource
You can send a URI to the server, and get pure data back.
The WP API is a RESTfull API WordPress that returns data objects in the
JSON format when provided with a route and an endpoints
Normally the Route is the URL and the Endpoints is action performs on
the URL.
https://developer.wordpress.org/rest-api/requests/
Basic Authentication
OAuth Authentication
Cookie Authentication
https://github.com/WP-API/Basic-Auth
https://github.com/WP-API/OAuth1
In Basic Authentication, the client requests a URL that requires verification. The
server, in turn, requests the client to identify itself by sending a 401 Not
Authorized code. In reply, the client sends the same request with the
credentials(in the username:password pair) in header field in base64 strings.
Since base64 strings could be decoded without much effort, this authentication
method is not very much secure.
https://github.com/WP-API/Basic-Auth
● Posts wp-json/wp/v2/posts
● Categories wp-json/wp/v2/categories
● Pages wp-json/wp/v2/pages
● Comments wp-json/wp/v2/comments
● Users wp-json/wp/v2/users
https://developer.wordpress.org/rest-api/reference/
The WordPress REST API provides you with more than just a set of built-in
routes. You can also create custom routes and endpoints using the same
APIs used to create default routes (for example, the register_rest_route()
function and the WP_Rest_Controller class etc.).
We can register user by this API as a subscriber role. It you would mail
your logging in details in the mail as well.
Prakash Singh
Wordpress Developer