API
The steadybit Web API allows interfacing with the platform to create, start, stop experiments, etc.
In order to use the API you need to create an API access token via the user interface. API access tokens are managed by the admin and team owners and is bound to a single team.
API token management can be found in Access Control → API Access Tokens.
Team Tokens
We differentiate between team tokens and admin tokens. Team tokens are bound to a team and can be used to access all experiments of a team.
Admin Tokens
Admin tokens have the ability to access all experiments of all teams and the ability to create/manage teams. Admin tokens are only available to the admin user.
Create a Admin Token via the API / CLI for onprem
Ssh to the steadybit platform server and run the following command:
/scripts/createAdminToken.sh
Missing mandatory arguments
Usage: /scripts/createAdminToken.sh -n <name> -t <tenantKey>
-n | --name <name> Name of the token
-t | --tenantKey <tenantKey> Tenant key
-h | --help Show this help
/scripts/createAdminToken.sh -t demo -n AdminToken
Z8pChlF2*************
The token will be printed to the console.
You can also run curl directly only via localhost:
curl --header "Content-Type: application/json" \
--request POST \
--data '{"name":"'$NAME'","tenantKey":"'$TENANTKEY'"}' \
http://localhost:9090/actuator/adminaccesstoken
We provide a OpenApi 3.0 Specification for the API as well as an interactive documentation. In case you are using our on-prem variant you can access it at
http://<your-installation-url>/api/spec
.This is how you can create an experiment (json is supported as well):
curl \
-i \
-H 'Content-Type: application/x-yaml' \
-H 'Authorization: accessToken XXXXXXXX.XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX' \
https://platform.steadybit.com/api/experiments \
--data '
---
name: Experiment API Test
team: ADM
environment: Global
lanes:
- steps:
- !<action>
actionType: check:http
parameters:
method: "GET"
url: "https://example.com"
headers: []
successRate: 100
maxConcurrent: 5
requestsPerSecond: 1
duration: "10s"
followRedirects: false
readTimeout: "5s"
connectTimeout: "5s"
statusCode: "200-299"
'
The
Location
header of the response indicates the url of the newly created experiment:location: https://platform.steadybit.com/api/experiments/ADM-
You can then run the experiment:
curl \
-i \
-X POST \
-H 'Authorization: accessToken XXXXXXXX.XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX' \
https://platform.steadybit.com/api/experiments/ADM-1/execute
Last modified 2mo ago