Who is the API Documentation Audience?
When you write API documentation, you write for the API developer. When it comes to API documentation, developers focus on two things:
- What requests look like (you want the server to understand it)
- What responses look like (you want to make sense of the data)
Supposed that my endpoint is located here:
I want to get a list of movies, so how do I get this result?
I want to keep the example simple, so let’s assume that I only have 3 movies with an id, title, and year.
Here is an example response from this simple request:
"title":"The Shawshank Redemption",
So what happened?
- I wanted to GET a list of my movies
- I got my list of movies
Now the API developer can use this information for whatever purpose, such as an UI option that lists all movies.
Using Swagger for API Documentation
Swagger provides an amazing standard to author and test elegant API documentation. I have used Swagger on several projects, and I won an STC award for my API content.
Swagger Usage Example
I am testing a new Swagger plugin for WordPress using their Petstore example. I will update with my own example API documentation after I test the plugin and play with my JSON a bit.