Tests API


Overview

The Tests API allows creation and deletion of Tests via the API. Remember that runs and results are separate APIs.

{warning} Only Load Tests (not SQL or DoS) are supported in the API.

List

List all the hosts on your account

GET /api/v2/tests

[
    {
        "id": 20,
        "created_at": "2021-02-13T17:07:34.000000Z",
        "updated_at": "2021-02-13T17:08:14.000000Z",
        "verified": true,
        "url": "example1.com",
        "port": 443,
        "protocol": "https"
    },
    {
        "id": 18,
        "created_at": "2021-02-13T16:44:48.000000Z",
        "updated_at": "2021-02-13T16:44:50.000000Z",
        "verified": true,
        "url": "example2.com",
        "port": 443,
        "protocol": "https"
    }
]

Create

For creating a new test

POST /api/v2/tests/create

{
    "name": "test example",
    "rate": 5, 
    "servers": 1,
    "users": 10,
    "host_id": 1,
    "region": "nyc3",
    "locustfile": "......"
}

Variables: 
 - name: Alphanumeric name of the test
 - rate: Spawn rate of the virtual users
 - servers: The number of worker servers to launch 
 - users: Total virtual users to simulate
 - host_id: The ID of your Host to test
 - region: One of the regions defined below
 - locustfile: The full locustfile to use 

{
    test_id: 123
}

Update

Update an existing Test, specified by ID.

PATCH /api/v2/tests/{test_id}

{
    "name": "test example",
    "rate": 5, 
    "servers": 1,
    "users": 10,
    "host_id": 1,
    "region": "nyc3",
    "locustfile": "......"
}

Variables: 
 - name: Alphanumeric name of the test
 - rate: Spawn rate of the virtual users
 - servers: The number of worker servers to launch 
 - users: Total virtual users to simulate
 - host_id: The ID of your Host to test
 - region: One of the regions defined below
 - locustfile: The full locustfile to use 

{
    test_id: 123
}

Delete

For deleting an existing test

DELETE /api/v2/tests/{test_id}

Variables: 
 - test_id: the id of the test to delete

{
    "test_id": 123,  
    "status": "Deleted"  
}

Regions

These are the available regions for tests. Use the 4 character code on the left with the API.

nyc3 => New York,
sfo3 => San Francisco,
lon1 => London,
ams3 => Amsterdam,
sgp1 => Singapore,
fra1 => Germany,
tor1 => Toronto,
blr1 => Bangalore,