Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consolidate current API tool documentation #2169

Merged
merged 11 commits into from
Jul 9, 2024
114 changes: 114 additions & 0 deletions docs/guide/api/api-documentation-tools.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
=======================
API documentation tools
=======================

Specialized descriptive languages help when writing API documentation.
Some of our favorite descriptive languages include:

* :ref:`blueprint`
* Swagger

When specifying a descriptive language for your API, you'll also need tools to create engaging
documents. Several tools work best with our favorite descriptive languages:

* :ref:`apiary-overview`
* Aglio
* :doc:`Sphinx </guide/tools/sphinx>`

.. _apiary-overview:

Apiary
~~~~~~

Apiary is a service that allows you to edit and host documentation online.

Hosting Apiary docs
-------------------

Apiary provides a service for creating and hosting API documentation described in the :ref:`blueprint`
or Swagger format. Once the API description is complete, Apiary generates interactive documentation in a
three column layout. Example requests and responses are shown for every endpoint in multiple
programming languages. It also enables the user to make requests to your live API.

.. _apiary-building-docs:

Building Apiary docs
--------------------

To build Apiary docs locally, follow these steps:

1. `Install the Apiary CLI Tools. <https://help.apiary.io/tools/apiary-cli/>`_
2. Navigate to the directory containing your ``.apib`` file.
3. Run the following to validate your ``.apib`` file and create the HTML file::

apiary preview --path="myfile.apib" --output="myfile.html"

4. View the document in your browser.

.. _blueprint:

API Blueprint
~~~~~~~~~~~~~

API Blueprint is a high-level language for describing web APIs. The goal of the API Blueprint format
is to support the design-first philosophy for REST APIs; however, the format also works for
documenting existing APIs. The files are saved with a `.apib` extension.

The syntax combines Markdown syntax and Markdown Syntax for Object Notation (MSON). Markdown is a
lightweight text formatting syntax and `MSON <https://github.com/apiaryio/mson>`_ is an extension
of Markdown for describing data objects.

Getting started with API Blueprint
----------------------------------

The quickest way to get started with API Blueprint is to use `Apiary <https://apiary.io/>`_ to edit and view your
documentation by following these steps:

1. Sign up for an account `on Apiary. <https://login.apiary.io/register>`_
2. Follow the `API Blueprint Tutorial. <https://apiblueprint.org/documentation/tutorial.html>`_ to describe an API.

Writing API Blueprint docs
--------------------------

The structure for an ``.apib`` file is::

Metadata
API Name
Resource Group
Resource
Action
Action
Resource
Resource Group
Data Structures

``Metadata``:
describes the API Blueprint version

``API Name``:
your API name

``Resource Groups``:
describes a collection of related API endpoints

``Resources``:
describes a specific API endpoint

``Actions``:
describes specific HTTP verb actions to an endpoint

``Data Structures``:
describes data used in your API requests/responses. By defining them in a separate section, they
can easily be reused.

Building API Blueprint docs
---------------------------

The two most popular tools for generating documents from API Blueprints are :ref:`Apiary <apiary-building-docs>` and
`Aglio <https://github.com/danielgtaylor/aglio>`_.

Testing API docs
~~~~~~~~~~~~~~~~

When specifying an API in a descriptive language, you don't have to manually
validate your documents. Tools like Dredd can test your documentation against the live API.
21 changes: 0 additions & 21 deletions docs/guide/api/apiary.rst

This file was deleted.

53 changes: 0 additions & 53 deletions docs/guide/api/apiblueprint.rst

This file was deleted.

13 changes: 0 additions & 13 deletions docs/guide/api/generating-documents.rst

This file was deleted.

12 changes: 0 additions & 12 deletions docs/guide/api/languages.rst

This file was deleted.

11 changes: 0 additions & 11 deletions docs/guide/api/testing.rst

This file was deleted.

6 changes: 2 additions & 4 deletions docs/guide/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,7 @@ API documentation
.. toctree::
:maxdepth: 2

api/languages
api/generating-documents
api/testing
api/api-documentation-tools

Contribution information
------------------------
Expand All @@ -89,4 +87,4 @@ Write the Docs resources
* `WTD Slack Network <https://writethedocs.org/slack/>`__
* `WTD Newsletters <https://writethedocs.org/newsletter/>`__
* Twitter: http://twitter.com/writethedocs
* Issues & feature requests: https://github.com/writethedocs/docs/issues
* Issues & feature requests: https://github.com/writethedocs/docs/issues
10 changes: 6 additions & 4 deletions docs/guide/tools/sphinx.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
.. _intro-sphinx:

======================
Introduction to Sphinx
======================
Expand Down Expand Up @@ -27,8 +29,8 @@ complexity.
Just know that some of the awkward syntax allows you to do more interesting
things further down the line.
In particular, it is extensible: it has a formal way of adding markup
`directives`_ that allow more sophisticated parsing.
For example, Sphinx includes directives to relate documentation of
`directives`_ that allow more sophisticated parsing.
For example, Sphinx includes directives to relate documentation of
modules, classes and methods to the corresponding code.

Installing Sphinx
Expand Down Expand Up @@ -105,12 +107,12 @@ following ``toctree`` directive in TopLevel1::
Child1
Child2
Child3

Different Sphinx themes will have different ways of displaying the TOC
in the sidebar. You can also configure whether or not to display the
toctree directive as a mini-toc within the topic itself, by adding a
``:hidden:`` option to the ``toctree`` directive.

Writing docs
------------

Expand Down
1 change: 1 addition & 0 deletions vale/WTD/headings.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ level: error
scope: heading
match: $sentence
exceptions:
- Apiary
- API
- API Blueprint
- ARID
Expand Down
Loading