From the course: Learning REST APIs

Unlock the full course today

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

Request/response pairs

Request/response pairs

From the course: Learning REST APIs

Start my 1-month free trial

Request/response pairs

- [Instructor] All this theory is well and good; but to really get REST APIs, you have to see one in action. So in this chapter, I want to dig into the standard request response pairs to show you how different types of requests are made, what the responses look like and, most importantly, what they do. For these examples, I'll use my locally-hosted WordPress site and the authorization header from the previous chapter. Remember, requests and responses will vary based on the configuration of the REST API you work with; but the overall structure and behavior will always be roughly the same. So while what you see here will not match what you'll see interacting with other REST APIs, the principles taught are the same. The first step in working with a REST API is discovery. For this, we'll use an options request. In the WordPress REST API, the posts resource is the resource collection for all the available posts on the site; so let's start there. I'll pass a request for options and then the…

Contents