All Collections
Integrations
REST API
Automating Swagger Documentation with Jenkins
Automating Swagger Documentation with Jenkins

Automate your API Documentation by seamlessly integrating your Continuous Integration (CI) tool with Ardoq.

Kristine Marhilevica avatar
Written by Kristine Marhilevica
Updated over a week ago

In this guide, you will see how to integrate Jenkins (or an integration tool of your choice) with Ardoq via the RESTful API. Every time you deploy code, your Swagger workspaces will be automatically updated in Ardoq. Cool, huh?

For the purpose of this guide, I will be using this git repository to use as a source for the swagger file.

First, you will need an API token. Once you have your token, create a new build step within Jenkins.
​

Ardoq Jenkins build step

Within the Ardoq build step, we will be executing a bash script to send a POST HTTP request to the Ardoq API.

Ardoq Jenkins post http request

Code:

#!/bin/bashecho "final build step: Updating Ardoq"SWAGGER_FILE="./examples/v2.0/json/petstore.json" # change to local path for your swagger filecurl -X POST \https://{your subdomain}.ardoq.com/swagger/import \-H 'content-type: application/x-www-form-urlencoded' \-d "wsname=My Swagger Workspace - built by jenkins!" \-d "org={your org name here}" \-d "token={your token here!}" \-d "swag=$(cat "$SWAGGER_FILE")" \

If the swagger workspace does not already exist in Ardoq, it will be created. If it does exist, the components will be updated with the new specification. All references will be preserved, too.

And here it is!
​

Ardoq Jenkins component tree

If you still have questions or need more information, reach out to us via our website or by using the in-app chat. πŸ’¬ After all, that's what we're here for.

Did this answer your question?