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.

Discovery

Discovery

From the course: Learning REST APIs

Start my 1-month free trial

Discovery

- A key step in working with a REST API is discovery, figuring out what resources and methods are available and what you can do with them. A good REST API has extensive standalone documentation, providing all this information in a human-readable format. But even if no documentation is present, the REST API will describe itself, thanks to the Hypermedia As The Engine Of Application State constraint. Using the get and options verbs, we can walk our way through the response of any REST API, to find its resources and methods. For a simple REST API, the map might be a single level of resource URIs with get methods. For a more complex REST API, like the WordPress REST API, there may be a complex tree of resources, each with their own methods that are documented within the response. If I run an options request to the posts resource, which gives us access to the collection of all posts in a WordPress site, you'll see what I mean. Here, we get a full breakdown of every available method and…

Contents