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/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!

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?