Review APIs with Confluence

The SwaggerHub Integration for Confluence macro allows you to embed an API definition into a Confluence page (cloud Atlassian only).

How to get the macro in your Confluence installation

To install the macro, go to Atlassian Marketplace. Download the plugin and install it.

How to embed an API into a Confluence page

To insert the SwaggerHub Integration for Confluence macro into a page, click on the + (insert) command in Confluence and type "swagger" into the Search box. Click on the SwaggerHub Integration for Confluence in the list and the macro will be inserted.

insert-macro.png

The macro dialog behaves like other Confluence macros. Simply fill in the values and click the Insert button to insert an API definition.

macro-settings.png
  1. Specify the type of API definition: OpenAPI or AsyncAPI.

  2. Enter the API to be embedded. You can do this two ways:

    1. Import the API definition into Confluence by pasting the API file into the API Definition field at the top right of the dialog OR dragging and dropping a file into the Upload area at the right – If you import in this way, you must re-import the API when you make changes.

    2. Enter a URL in the API > URL field in the left column – if you link a URL in this way, changes to the API will be re-loaded into your Confluence page whenever a user reloads the page.

  3. Specify the Access Token/API Key or access credentials for the API (if required).

How to get an API token

For protected APIs that you have access to, you can get an API key from SwaggerHub and use it to access protected API definitions. To retrieve an API key, go to Settings > API Keys in SwaggerHub. You can then generate an API key which can be entered in the API Key field.

How to reference a SwaggerHub API definition by its URL

Your SwaggerHub API definitions can be accessed through this pattern:

https://api.swaggerhub.com/apis/{owner}/{api}/{version}

If you are using SwaggerHub on-premise, your SwaggerHub API definitions can be accessed through this pattern:

http(s)://SERVER/v1/apis/{owner}/{api}/{version}

If your on-premise installation of SwaggerHub is airgapped or behind a firewall, you may need to contact tech support to figure out how to embed your APIs using this Confluence macro.

Specifying OpenAPI options

For OpenAPI files you will have the following options.

openapi-settings.png

Specifying AsyncAPI options

For AsyncAPI files you will have the following options.

asyncapi-settings.png

Embedding the API into the page

Once you have specified the desired options, click on Insert to embed the API definition into your Confluence page.

Working with embedded APIs

Once your API is embedded, the controls are simple and standard. Use the v control to expand items and the ^ control to collapse items.

api-display.png
Publication date: