OctoPerf Rest API¶
Our REST API documentation is available at https://api.octoperf.com/swagger-ui.html
It gives you a programmatic access to all OctoPerf resources, from Virtual Users to Tests Reports.
Samples¶
Starting a Test Using cURL¶
To to start a test you need to call the Scenarios.run endpoint:
curl --header "Authorization: Bearer <apiKey>" -v -X POST https://api.octoperf.com/runtime/scenarios/run/<scenarioId>
The following parameters must be set:
- apiKey: your API key can be found in your profile, accessible from the Profile menu in OctoPerf (top right corner of the UI).
- scenarioId: the ID of the scenario you want to run.
To know the ID of the scenario simply open it in OctoPerf's UI. Its ID is the last one in the URL:
Tip
If you want to schedule a load test you can then use crontab on Linux or an online scheduling service to do it.
Starting a Test with a template¶
It is possible to pass additional parameters to the previous POST
request to select for instance the report template to be used.
But first we need to know the report template id, so we are going to execute the following request:
curl --header "Authorization: Bearer <apiKey>" -v -X GET https://api.octoperf.com/analysis/bench-report-templates/by-workspace/<workspaceId>
To find the workspaceId
just look at the URL when you're inside the workspace:
The result will be a list of all the templates of this workspace. Here with the templateId
highlighted:
Now you just want to run the same POST
request than earlier but with the templateId
specified like this:
curl --header "Authorization: Bearer <apiKey>" -v -X POST https://api.octoperf.com/runtime/scenarios/run/<scenarioId>?templateId=<templateId>