Load Testing API

Ddosify Load Testing API

You can automate the process of load testing your web applications or APIs, and easily incorporate load testing into your CI/CD pipeline.

Our API provides a wide range of features, including the ability to create load test plans, run load tests, and retrieve detailed reports and metrics on test results. You can also create environment variables and test data (CSV) using this API. The API is designed to be easy to use, with a RESTful architecture and JSON-based responses.

In this section, you will find the APIs for test and plan endpoints. It's recommended to start the load test with a test plan using this endpoint. You can create test plans easily with no-code UI using Ddosify Cloud. You can select the Save as Test Plan in the summary page of the test suite. Once you create the test plan you can get the test plan id from the URL: https://app.ddosify.com/load/configure-test-plans/<TEST_PLAN_ID>

You can also find different examples of this API.

All endpoints require the X-API-KEY header for authentication. Please check the Get Your API Key section to learn how you can get it.

For every successful load test, you'll be charged for request_count and duration in the body config_data.

API concurrency limit is 5 requests per second for GET endpoints and 2 requests per second for others. You will get HTTP 429 (Concurrency Limit Exceeded) when you reach the concurrency.

Load Test

Create a Load Test

POST https://api.ddosify.com/v1/load/test/

Headers

NameTypeDescription

X-API-KEY*

UUID

Your API KEY

Request Body

NameTypeDescription

name*

String

Name of the test

config_data*

JSON

Configuration of the load test. More.

{
    "id": "fda3642b-df27-409d-b24d-63f861840ac5",
    "test_url": "https://app.ddosify.com/load/report/fda3642b-df27-409d-b24d-63f861840ac5",
    "status": "initial",
    "failure_reason": null
}

POST https://api.ddosify.com/v1/load/test/

Headers

NameTypeDescription

X-API-KEY*

UUID

Your API KEY

Request Body

NameTypeDescription

name*

String

Name of the test

test_plan_template_id*

UUID

Test Plan ID. Create test plan with this endpoint.

environment_id

UUID

Environment ID to override the test. Get the environments from this endpoint.

{
    "id": "fda3642b-df27-409d-b24d-63f861840ac5",
    "test_url": "https://app.ddosify.com/load/report/fda3642b-df27-409d-b24d-63f861840ac5",
    "status": "initial",
    "failure_reason": null
}

Get Load Tests

GET https://api.ddosify.com/v1/load/test/

Headers

NameTypeDescription

X-API-KEY*

UUID

Your API KEY

[
    {
        "id": "0b04ac74-b389-4749-9fa8-7484900d8319",
        "environment_id": null,
        "test_plan_template_id": null,
        "name": "Test 14",
        "testdata_ids": null,
        "date_created": "2023-03-04T00:25:50.225449Z",
        "status": "done",
        "failure_reason": null
    },
    {
        "id": "83cef293-3929-4137-a107-8890d96c43b1",
        "environment_id": null,
        "test_plan_template_id": null,
        "name": "Admin Test 10",
        "testdata_ids": null,
        "date_created": "2023-02-24T09:56:01.765072Z",
        "status": "done",
        "failure_reason": null
    },
    {
        "id": "82d8b25f-6e78-4281-b7db-b7235c0a9a2d",
        "environment_id": null,
        "test_plan_template_id": null,
        "name": "Admin Test 10",
        "testdata_ids": null,
        "date_created": "2023-02-23T11:54:50.012640Z",
        "status": "done",
        "failure_reason": null
    }
]

Retrieve details of the Load Test

GET https://api.ddosify.com/v1/load/test/<TEST_ID>/

Headers

NameTypeDescription

X-API-KEY*

UUID

Your API KEY

{
    "id": "5308bc3c-7bc3-4a25-95d8-abdb57042098",
    "environment_id": null,
    "test_plan_template_id": null,
    "name": "Test 14",
    "config_data": {
        "steps": [
            {
                "id": 1,
                "url": "https://servdown.com",
                "name": "Home Page",
                "method": "GET",
                "others": {
                    "h2": false,
                    "keep-alive": false,
                    "disable-redirect": false,
                    "disable-compression": false
                },
                "headers": {
                    "Host": "asgfasfgas"
                },
                "payload": "{\"id\": 5}",
                "timeout": 15
            }
        ],
        "duration": 20,
        "load_type": "linear",
        "proxy_config": {
            "DE": 50,
            "US": 50
        },
        "request_count": 100
    },
    "testdata_ids": null,
    "date_created": "2023-03-02T18:01:45.819888Z",
    "status": "done",
    "failure_reason": null
}

Result of Load Test

GET https://api.ddosify.com/v1/load/test/<TEST_ID>/result/

This endpoint waits until the test is finished. More.

Headers

NameTypeDescription

X-API-KEY*

UUID

Your API KEY

{
    "test_url": "https://app.ddosify.com/load/report/9272cecd-b844-43bc-9702-469895f20d90",
    "results": {
        "steps": [
            {
                "id": 1,
                "error_dist": {},
                "fail_count": 0,
                "location_dist": {
                    "DE": {
                        "error_dist": {},
                        "fail_count": 0,
                        "location_dist": {},
                        "success_count": 500,
                        "response_times": {
                            "avg": 26,
                            "max": 63,
                            "min": 19,
                            "p80": 29,
                            "p90": 33,
                            "p95": 37,
                            "p99": 56,
                            "median": 24,
                            "stddev": 6
                        },
                        "iteration_count": 500,
                        "status_code_dist": {
                            "405": 500
                        }
                    },
                    "US": {
                        "error_dist": {},
                        "fail_count": 0,
                        "location_dist": {},
                        "success_count": 500,
                        "response_times": {
                            "avg": 172,
                            "max": 201,
                            "min": 162,
                            "p80": 175,
                            "p90": 178,
                            "p95": 181,
                            "p99": 193,
                            "median": 171,
                            "stddev": 5
                        },
                        "iteration_count": 500,
                        "status_code_dist": {
                            "405": 500
                        }
                    }
                },
                "success_count": 1000,
                "response_times": {
                    "avg": 99,
                    "max": 201,
                    "min": 19,
                    "p80": 172,
                    "p90": 175,
                    "p95": 178,
                    "p99": 189,
                    "median": 113,
                    "stddev": 73
                },
                "iteration_count": 1000,
                "status_code_dist": {
                    "405": 1000
                }
            },
            {
                "id": 2,
                "error_dist": {},
                "fail_count": 0,
                "location_dist": {
                    "DE": {
                        "error_dist": {},
                        "fail_count": 0,
                        "location_dist": {},
                        "success_count": 500,
                        "response_times": {
                            "avg": 48,
                            "max": 242,
                            "min": 35,
                            "p80": 51,
                            "p90": 57,
                            "p95": 70,
                            "p99": 131,
                            "median": 44,
                            "stddev": 17
                        },
                        "iteration_count": 500,
                        "status_code_dist": {
                            "200": 500
                        }
                    },
                    "US": {
                        "error_dist": {},
                        "fail_count": 0,
                        "location_dist": {},
                        "success_count": 500,
                        "response_times": {
                            "avg": 323,
                            "max": 807,
                            "min": 296,
                            "p80": 317,
                            "p90": 332,
                            "p95": 383,
                            "p99": 684,
                            "median": 307,
                            "stddev": 64
                        },
                        "iteration_count": 500,
                        "status_code_dist": {
                            "200": 500
                        }
                    }
                },
                "success_count": 1000,
                "response_times": {
                    "avg": 186,
                    "max": 807,
                    "min": 35,
                    "p80": 309,
                    "p90": 317,
                    "p95": 332,
                    "p99": 678,
                    "median": 269,
                    "stddev": 145
                },
                "iteration_count": 1000,
                "status_code_dist": {
                    "200": 1000
                }
            }
        ],
        "fail_count": 0,
        "location_dist": {
            "DE": {
                "fail_count": 0,
                "success_count": 500,
                "response_times": {
                    "avg": 37,
                    "max": 242,
                    "min": 19,
                    "p80": 46,
                    "p90": 52,
                    "p95": 59,
                    "p99": 96,
                    "median": 37,
                    "stddev": 17
                },
                "iteration_count": 500
            },
            "US": {
                "fail_count": 0,
                "success_count": 500,
                "response_times": {
                    "avg": 247,
                    "max": 807,
                    "min": 162,
                    "p80": 309,
                    "p90": 317,
                    "p95": 332,
                    "p99": 678,
                    "median": 249,
                    "stddev": 88
                },
                "iteration_count": 500
            }
        },
        "success_count": 1000,
        "response_times": {
            "avg": 142,
            "max": 807,
            "min": 19,
            "p80": 303,
            "p90": 309,
            "p95": 317,
            "p99": 400,
            "median": 163,
            "stddev": 122
        },
        "iteration_count": 1000
    }
}

Stop the Load Test

GET https://api.ddosify.com/v1/load/test/<TEST_ID>/stop/

Headers

NameTypeDescription

X-API-KEY*

UUID

Your API KEY

Get Supported Load Locations

GET https://api.ddosify.com/v1/load/locations/

Headers

NameTypeDescription

X-API-KEY*

UUID

Your API KEY

{
    "countries": [
        "AU",
        "BE",
        "CA",
        "CH",
        "CN",
        "DE",
        "ES",
        "FI",
        "FR",
        "GB",
        "HK",
        "HR",
        "HU",
        "IL",
        "IT",
        "JP",
        "NL",
        "NO",
        "PL",
        "RO",
        "RS",
        "SE",
        "TR",
        "UA",
        "US"
    ]
}

Config Data

Config data contains the configuration of the load test to start a load test and create load test plan endpoints. Here is an example:

{
    "steps": [
        {
            "id": 1,
            "url": "https://servdown.com",
            "name": "Home Page",
            "method": "POST",
            "others": {
                "h2": false,
                "disable-redirect": false,
                "disable-compression": false
            },
            "headers": {
                "Test-Header": "Test Value",
                "Test-Header2": "Test Value2"
            },
            "payload": "{\"id\": 24}",
            "timeout": 15
        },
        {
            "id": 2,
            "url": "https://app.servdown.com",
            "name": "Servdown App",
            "method": "GET",
            "others": {
                "h2": false,
                "disable-redirect": false,
                "disable-compression": false
            },
            "timeout": 15
        }
    ],
    "proxy_config": {
        "US": 50,
        "DE": 50
    },
    "iteration_count": 1000,
    "load_type": "linear",
    "duration": 20
}

This load-testing configuration includes two steps, each of which represents a specific action to be executed by the load-testing tool.

The first step represents a POST request to the "https://servdown.com" URL with a payload of {"id": 24}. The headers of the request include Test-Header with a value of Test Value and Test-Header2 with a value of Test Value2. The timeout for this step is set to 15 seconds.

The second step represents a GET request to the "https://app.servdown.com" URL. The timeout for this step is also set to 15 seconds.

The proxy_config field indicates that the load testing tool will use a mix of US (United States) and DE (Germany) servers, with a 50/50 distribution. You can get the full list of the supported locations by using this endpoint.

The iteration_count field indicates that the load testing tool will execute each step 1000 times. There will be a total of 1000*2=2000 requests.

The load_type field specifies a linear load pattern, which means that the load will be the same over time.

The duration field indicates that the load testing will last for 20 seconds.

KeySupportedDescription

proxy_config

"AU","BE","CA","CH","CN","DE","ES","FI","FR","GB","HK","HR","HU","IL","IT","JP","NL","NO","PL","RO","RS","SE","TR","UA","US"

Supported locations. You can get the list with this endpoint.

load_type

"linear", "waved", "incremental"

Type of the load. More.

Load Test Plan

Create a Load Test Plan

POST https://api.ddosify.com/v1/load/plan/

Headers

NameTypeDescription

X-API-KEY*

UUID

Your API KEY

Request Body

NameTypeDescription

name*

String

Test plan name. It's unique.

config_data*

JSON

Configuration of the load test. More.

{
    "id": "49350aff-1b77-493f-bb20-9742ed345a0c"
}

Get Load Test Plans

GET https://api.ddosify.com/v1/load/plan/

Headers

NameTypeDescription

X-API-KEY*

UUID

Your API KEY

[
    {
        "id": "6c140d00-c01f-4d60-935a-6d4424f49497",
        "test_count": 1,
        "environment_id": null,
        "name": "Fatih Test TestPlan Template 392124212242",
        "testdata_ids": null,
        "date_created": "2023-02-23T10:33:20.848546Z"
    },
    {
        "id": "d5c3b48c-cea1-4949-aae0-caa73bea6242",
        "environment_name": "Test Environment Name 6",
        "test_count": 2,
        "environment_id": "0fe50223-32a5-4cf6-9079-58e02d256331",
        "name": "Fatih Test TestPlan Template 434",
        "testdata_ids": [
            "7feefbce-8189-42f5-9c93-edfe58023b46"
        ],
        "date_created": "2023-02-18T22:06:04.647822Z"
    },
    {
        "id": "3010a2ed-3b01-41cb-a2f0-78b32ddda6c8",
        "test_count": 0,
        "environment_id": null,
        "name": "Fatih Test TestPlan New Name",
        "testdata_ids": null,
        "date_created": "2023-02-14T12:46:14.250734Z"
    }
]

Retrieve details of the Load Test Plan

GET https://api.ddosify.com/v1/load/plan/<PLAN_ID>/

Headers

NameTypeDescription

X-API-KEY*

UUID

Your API KEY

{
    "id": "6d0a3cd4-a625-407c-9dc7-c7702b670550",
    "environment_id": null,
    "name": "Test TestPlan Template 1241241",
    "config_data": {
        "steps": [
            {
                "id": 1,
                "url": "https://app.servdown.com/accounts/login/?next=/",
                "method": "GET",
                "headers": {
                    "ContenType": "application/xml",
                    "X-ddosify-key": "ajkndalnasd"
                },
                "payload": "",
                "timeout": 5
            }
        ],
        "duration": 10,
        "load_type": "linear",
        "proxy_config": {
            "DE": 30,
            "GB": 20,
            "US": 50
        },
        "request_count": 100
    },
    "testdata_ids": null,
    "date_created": "2023-02-28T15:36:36.510444Z"
}

Update the Load Test Plan

PATCH https://api.ddosify.com/v1/load/plan/<PLAN_ID>/

Headers

NameTypeDescription

X-API-KEY*

UUID

Your API KEY

Request Body

NameTypeDescription

name

String

Test plan name

config_data

JSON

Configuration of the load test. More.

{
    "id": "49350aff-1b77-493f-bb20-9742ed345a0c",
    "environment_id": null,
    "name": "TestPlan New Name",
    "config_data": {
        "steps": [
            {
                "id": 1,
                "url": "https://app.servdown.com/accounts/login/?next=/",
                "method": "GET",
                "headers": {
                    "ContenType": "application/xml",
                    "X-ddosify-key": "ajkndalnasd"
                },
                "payload": "",
                "timeout": 5
            }
        ],
        "duration": 10,
        "load_type": "linear",
        "proxy_config": {
            "DE": 30,
            "GB": 20,
            "US": 50
        },
        "request_count": 100
    },
    "testdata_ids": null
}

Delete the Load Test Plan

DELETE https://api.ddosify.com/v1/load/plan/<PLAN_ID>/

Headers

NameTypeDescription

X-API-KEY*

UUID

Your API KEY

{
    // Response
}

Environment

Create Environment

POST https://api.ddosify.com/v1/environment/

Example.

Headers

NameTypeDescription

X-API-KEY*

UUID

Your API KEY

Request Body

NameTypeDescription

name*

String

Environment name. It's unique.

vars*

JSON

Variables. More.

{
    "id": "e5cf444d-9d76-4ba6-843c-b20d2bcf3302"
}

Get Environments

GET https://api.ddosify.com/v1/environment/

Headers

NameTypeDescription

X-API-KEY*

UUID

Your API KEY

```json
[
    {
        "id": "e5cf444d-9d76-4ba6-843c-b20d2bcf3302",
        "name": "Test Environment Name 5",
        "vars": [
            {
                "key": "test_key_1_bool",
                "value": false
            },
            {
                "key": "test_key_2_string",
                "value": "test_value_2"
            },
            {
                "key": "test_key_2_number_int",
                "value": 15
            },
            {
                "key": "test_key_2_number_float",
                "value": 15.2
            },
            {
                "key": "test_key_2_number_list",
                "value": [
                    14,
                    12,
                    15
                ]
            }
        ],
        "date_created": "2023-03-05T20:59:13.440806Z"
    },
    {
        "id": "8ad0f224-c338-4722-9c6d-ef14abcf8449",
        "name": "Test Environment Name 3",
        "vars": [
            {
                "key": "test_key_1",
                "value": false
            },
            {
                "key": "test_key_2",
                "value": "test_value_2"
            }
        ],
        "date_created": "2023-03-05T19:29:20.582063Z"
    }
]

Retrieve details of the Environment

GET https://api.ddosify.com/v1/environment/<ENVIRONMENT_ID>/

Headers

NameTypeDescription

X-API-KEY*

UUID

Your API KEY

{
    "id": "e5cf444d-9d76-4ba6-843c-b20d2bcf3302",
    "name": "Test Environment Name 5",
    "vars": [
        {
            "key": "test_key_1_bool",
            "value": false
        },
        {
            "key": "test_key_2_string",
            "value": "test_value_2"
        },
        {
            "key": "test_key_2_number_int",
            "value": 15
        },
        {
            "key": "test_key_2_number_float",
            "value": 15.2
        },
        {
            "key": "test_key_2_number_list",
            "value": [
                14,
                12,
                15
            ]
        }
    ],
    "date_created": "2023-03-05T20:59:13.440806Z"
}

Update the Environment

PATCH https://api.ddosify.com/v1/environment/<ENVIRONMENT_ID>/

Headers

NameTypeDescription

X-API-KEY*

UUID

Your API KEY

Request Body

NameTypeDescription

name

String

Environment name. It's unique.

vars

JSON

Variables. More.

{
    "id": "e5cf444d-9d76-4ba6-843c-b20d2bcf3302",
    "name": "Test Environment Name 12421",
    "vars": [
        {
            "key": "test_key_3",
            "value": 1234
        },
        {
            "key": "test_key_2",
            "value": "test_value_2"
        }
    ]
}

Delete the Environment

DELETE https://api.ddosify.com/v1/environment/<ENVIRONMENT_ID>/

Headers

NameTypeDescription

X-API-KEY*

UUID

Your API KEY

vars

vars represents the environment variables for Create Environment endpoint.

Each key-value pair consists of a key and a value. The key represents the name of the environment variable to be set, and the value represents the value to be assigned to that variable.

The types of values can be bool, number, string and array. Here is an example of vars:

[
    {"key": "test_key_bool", "value": false},
    {"key": "test_key_string", "value": "test_value_2"},
    {"key": "test_key_number_int", "value": 15},
    {"key": "test_key_number_float", "value": 15.2},
    {"key": "test_key_array", "value": [14, 12, 15]}
]

In this specific example, there are five environment variables:

  • test_key_bool with a type of bool and value of false

  • test_key_string with a type of string and value of test_value_2

  • test_key_number_int with a type of number and value of 15

  • test_key_number_float with a type of number and value of 15.2

  • test_key_array with a type of array and value of [14, 12, 15]

Test Data (CSV)

Create Test Data

POST https://api.ddosify.com/v1/testdata/

Headers

NameTypeDescription

X-API-KEY*

UUID

Your API KEY

Request Body

NameTypeDescription

name*

String

Test Data name. It's unique.

file*

File

CSV File

type

String

Default is csv.

file_config*

JSON

File config. More.

{
    "id": "6c50cc89-8c1f-46f1-af9d-d61fdfc4c2f4",
    "name": "name_of_file",
    "file": "https://URL/media/testdata/38f79dbc-742f-4c73-9451-d30b54f412d2/6c50cc89-8c1f-46f1-af9d-d61fdfc4c2f4/original/medals.csv",
    "type": "csv",
    "file_config": {
        "delimiter": ";",
        "vars": {
            "0": {
                "tag": "year",
                "type": "int"
            },
            "1": {
                "tag": "city"
            },
            "2": {
                "tag": "sport"
            },
            "5": {
                "tag": "event",
                "type": "json"
            },
            "7": {
                "tag": "medal"
            },
            "8": {
                "tag": "no"
            }
        },
        "allow_quota": true,
        "order": "random",
        "skip_first_line": true,
        "skip_empty_line": true
    },
    "no_of_records": 2311,
    "size": 147343,
    "date_created": "2023-01-25T09:47:42.592256Z"
}

Get Test Data

GET https://api.ddosify.com/v1/testdata/

Headers

NameTypeDescription

X-API-KEY*

UUID

Your API KEY

[
    {
        "id": "0696f680-96db-4b1a-b435-28238c2d7ecd",
        "name": "transactions2",
        "file": "https://URL/media/staging/testdata/d8beff19-9310-426b-9e21-a610ae956884/0696f680-96db-4b1a-b435-28238c2d7ecd/original/transactions.csv",
        "type": "csv",
        "file_config": {
            "vars": {
                "0": {
                    "tag": "api_key",
                    "type": "string"
                },
                "1": {
                    "tag": "amount",
                    "type": "string"
                },
                "2": {
                    "tag": "from",
                    "type": "string"
                },
                "3": {
                    "tag": "to",
                    "type": "string"
                }
            },
            "order": "random",
            "delimiter": ",",
            "allow_quota": false,
            "skip_empty_line": true,
            "skip_first_line": true
        },
        "no_of_records": 1000,
        "size": 52772,
        "date_created": "2023-02-20T18:59:54.037321Z"
    },
    {
        "id": "f6903569-1a14-4f86-b5c8-5b2e034d739c",
        "name": "test_data",
        "file": "https://URL/media/staging/testdata/d8beff19-9310-426b-9e21-a610ae956884/f6903569-1a14-4f86-b5c8-5b2e034d739c/original/test_data.csv",
        "type": "csv",
        "file_config": {
            "vars": {
                "0": {
                    "tag": "Username",
                    "type": "string"
                },
                "1": {
                    "tag": "City",
                    "type": "string"