Skip to content

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.

Tip

To get a real life example of a call to our API, simply use our UI while recording with the dev tools, exactly like a virtual user recording.

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:

Scenario ID

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:

Workspace ID

The result will be a list of all the templates of this workspace. Here with the templateId highlighted:

Template ID

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>

Downloading a report

To download a report as a PDF file you will need:

  • apiKey: your API key can be found in your profile, accessible from the Profile menu in OctoPerf (top right corner of the UI).
  • reportId: the ID of the report you want to print.

To know the ID of the report simply open it in OctoPerf's UI. Its ID is the last one in the URL:

Report ID

Then download this shell script (download-report.sh) (more information about what the script does is available as inline comments).

Make it executable with chmod +x download-report.sh and execute it with ./download-report.sh <report ID> <API Key>.