From the course: WordPress: REST API
Unlock the full course today
Join today to access over 24,800 courses taught by industry experts.
Communicating with the REST API - WordPress Tutorial
From the course: WordPress: REST API
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…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
What is the WordPress REST API?2m 42s
-
(Locked)
What are RESTful APIs and JSON?2m 16s
-
(Locked)
Routes and endpoints1m 43s
-
(Locked)
Communicating with the REST API4m 16s
-
(Locked)
Explore the REST API response7m 23s
-
(Locked)
Useful routes: A quick reference5m 8s
-
(Locked)
Expanding the response with embeds6m 14s
-
(Locked)
Challenge: Find posts in a category2m
-
(Locked)
Solution: Find posts in a category5m 18s
-
-
-
-
-