In this guide you will see how to integrate Jenkins ( or 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.

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

First thing, you will need an API token.

Once you have your token, create a new build step within Jenkins.

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

Code:

#!/bin/bash

echo "final build step: Updating Ardoq"
SWAGGER_FILE="./examples/v2.0/json/petstore.json" # change to local path for your swagger file

curl -X POST \
https://swagger.addon.ardoq.com/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!

Did this answer your question?