Top

Documentation

REST APIs

We are happy to announce APIs to interact with the system

Main idea behind the REST APIs is to allow you to build integration with your Continuous Integration workflow. So if you won't find the call you would need -- just let us know and we will figure something out.

First you need to generate your API key to interact with calls. This can be done on your profile's page. You will need to pass that key as 'x-api-key' header.

Index of calls

 

Compare predefined environments

This call can be used for example when you are doing release to staging environment and would like to check it against production.

POST http://backtrac.io/api/project/{id}/{method}

Where {id} is ID of your project. On the project's page you can see the ID in URL (i.e. node/159 means project's id is 159).

{method} can be one of: compare_prod_stage, compare_prod_dev or compare_stage_dev. Each of them compare environments between themselves.

Here is example of the call written in bash:

curl --header 'x-api-key: 48ca959376d1fa45b822eeee717f04b6' --request POST http://backtrac.io/api/project/159/compare_prod_dev

 

Compare custom environments

This is a bit more advanced version of previous call. It is aimed to assist you with comparing your dynamic environments (i.e. builds on your CI system).

Calls signature is:

POST http://backtrac.io/api/project/{id}/compare_custom

Arguments to be passed as JSON encoded string in request body

url1 URL of the first website to compare
sn1_name title of the snapshot for the first custom URL
url2 URL of the second website to compare
sn2_name title of the snapshot for the second custom URL
diff_name title of the Diff that will compare above two snapshots
login1 object of auth data for url1
 
url URL to login
usernameSelector Username Selector (CSS selector for the username form element, i.e. #edit-user-name)
passwordSelector Password Selector (CSS selector for the password form element, i.e. #edit-pass)
submitSelector Submit Selector (CSS selector for the submit button form element, i.e. #edit-submit)
username Username
password Password
login2 object of auth data for url2
 
url URL to login
usernameSelector Username Selector (CSS selector for the username form element, i.e. #edit-user-name)
passwordSelector Password Selector (CSS selector for the password form element, i.e. #edit-pass)
submitSelector Submit Selector (CSS selector for the submit button form element, i.e. #edit-submit)
username Username
password Password

Only url1 and url2 arguments are required.

Example of the call:

curl --header 'x-api-key: 48ca959376d1fa45b822eeee717f04b6' --request POST http://backtrac.io/api/project/159/compare_custom --data '{"url1":"http:\/\/ci.example.com\/build302","sn1_name":"build302","url2":"http:\/\/ci.example.com\/build304","sn2_name":"build304","diff_name":"build302 vs build304","login1":{"url": "http:\/\/ci.example.com\/build302\/user","usernameSelector":"#edit-name","passwordSelector":"#edit-pass","submitSelector":"#edit-submit","username":"admin","password":"pass"}, "login2": {"url": "http:\/\/ci.example.com\/build302\/user","usernameSelector":"#edit-name","passwordSelector":"#edit-pass","submitSelector":"#edit-submit","username":"admin","password":"pass"}}'

 

Monitor environment

This call to be used when you would like to see what has been changed to particular environment. It will create a snapshot and compare it to the latest snapshot created on this environment.

Call's signature is:

POST http://backtrac.io/api/project/{id}/compare_itself

Argument to be passed as JSON encoded string in request body

env Name of the environment: production, staging, development.

Example of the call:

curl --header 'x-api-key: 48ca959376d1fa45b822eeee717f04b6' --request POST http://backtrac.io/api/project/159/compare_itself --data '{"env":"production"}'