8 Preparing and hosting API documentation

 

This chapter covers

  • Adding metadata to our API definition
  • Writing a description in Markdown
  • Grouping operations together using tags
  • Hosting our API documentation online using Swagger UI and Netlify.com

In this chapter we’re going to take our OpenAPI definition and turn it into online documentation (see figure 8.1). Before hosting it online, we’ll add some human touches, such as API metadata, rich text descriptions, and operation tags. These touches will make it a lot easier for our users to consume.

Figure 8.1 Where we are
08-01

So far we’ve only been describing the bare essentials of the API, such as what operations exist and how to use them. This is the meat of the definition, but we’re lacking a softness that comes from one person explaining the API to another. In addition, we’re lacking some critical information that consumers require, such as the license of the API (are they allowed to consume it?) and contact information in case they need to reach out. We’ll be adding this metadata to the definition under the info section.

Metadata is the data about data, and it’s a fun term to use. In our context, it’s data about the API definition: useful data that isn’t directly related to the mechanics of the API.

8.1 The problem

 
 
 

8.2 Adding metadata to the definition

 

8.3 Writing the description in Markdown

 
 
 
 

8.3.1 Markdown basics

 

8.3.2 Adding a rich text description to the FarmStall API definition

 
 

8.4 Organizing operations with tags

 
 
 

8.4.1 Adding the Reviews tag to GET /reviews

 
 

8.4.2 Adding descriptions to tags

 
 

8.4.3 Adding the rest of the tags

 
 

8.6 The end of part 1

 
 
 
 
sitemap

Unable to load book!

The book could not be loaded.

(try again in a couple of minutes)

manning.com homepage