From the course: WordPress: REST API

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Communicating with the REST API

Communicating with the REST API - WordPress Tutorial

From the course: WordPress: REST API

Start my 1-month free trial

Communicating with the REST API

- [Instructor] The WordPress REST API and all its routes and endpoints sit at your WordPress site under a common URL, yoursite.com/wp-json. From here we can request any of the content or any of the information about the site. So, for example, if I want the 10 most recent posts from my site, which sits at mor10.com, I can simply go to my browser address bar, which passes a GET request, and say GET mor10.com/wp-json and then I have to tunnel into the different routes and endpoints. So here, I want wp/v2/posts. When I hit return, the GET request is processed and WordPress returns JSON to the client, in my case, the browser. Two things are immediately obvious here. First, this response was pretty much instantaneous because it's just pure data. Second, this compact, standardized JSON format is not so easy to read, at least not for a human being using a browser. There's a simple reason for this, a web browser is built to…

Contents