0% found this document useful (0 votes)
27 views1 page

Documenting An API 1. Write The API Reference Content

The document outlines the steps to document an API including writing reference content in code annotations, generating a specification from the code, rendering the specification for the reference, writing additional non-reference content, and publishing the documentation.

Uploaded by

matt
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
27 views1 page

Documenting An API 1. Write The API Reference Content

The document outlines the steps to document an API including writing reference content in code annotations, generating a specification from the code, rendering the specification for the reference, writing additional non-reference content, and publishing the documentation.

Uploaded by

matt
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

Documenting an API

1. Write the API reference content

The displayed content is always the most important consideration when creating API reference
documentation. This content is added to the API source code through annotations (typically
Swagger objects) by the developers as they write the code. You can access the source code
through Git, or a similar tool, to modify the annotations and write what you want to display to a
user in the reference.

2. Generate the API specification from the code

The API specification defines the basic structure of the API, and determines how the API is
used. The annotations in the code are used to automatically generate the API specification,
which will include the written reference content that you have added. Most APIs adhere to the
OpenAPI Specification, which provides a standard for how APIs are described.

3. Render the API specification for the reference

Render the API specification using a tool such as Swagger UI or Stoplight. This determines how
the reference content will be visualised to a user, and how a user can interact with the content
on the site.

4. Write the non-reference content

API documentation sites typically have content in addition to the reference, such as a getting
started guide, tutorials, and best practices. This content is not described in the API specification.
It is written separately in Markdown, and displayed using a static site generator like Jekyll or
Hugo. It is a common practice to manage this portion of the documentation in the same way as
the reference content (part of the code), using version control, branching, continuous
integration, automated tests, etc.

5. Show the world!

When the API is ready to be released, these pages (reference and non-reference) can be added
to the public site for the API.

You might also like