Comment on page
Load Testing Examples
Ddosify Load Testing API Examples
Here are the examples of the Load Testing API with cURL and Python.
cURL
Python
curl --location 'https://api.ddosify.com/v1/load/test/' \
--header 'X-API-KEY: <API_KEY>' \
--header 'Content-Type: application/json' \
--data '{
"name": "Test 14",
"config_data": {
"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
}
}'
import requests
import json
url = "https://api.ddosify.com/v1/load/test/"
payload = json.dumps({
"name": "Test 14",
"config_data": {
"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
}
})
headers = {
'X-API-KEY': '<API_KEY>',
'Content-Type': 'application/json'
}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.text)
cURL
Python
PLAN_ID=6d0a3cd4-a625-407c-9dc7-c7702b670550
curl --location 'https://api.ddosify.com/v1/load/plan/$PLAN_ID/' \
--header 'X-API-KEY: <API_KEY>'
import requests
plan_id="6d0a3cd4-a625-407c-9dc7-c7702b670550"
url = f"https://api.ddosify.com/v1/load/plan/{plan_id}/"
payload={}
headers = {
'X-API-KEY': '<API_KEY>'
}
response = requests.request("GET", url, headers=headers, data=payload)
print(response.text)
cURL
Python
curl --location 'https://api.ddosify.com/v1/environment/' \
--header 'X-API-KEY: <API_KEY>' \
--header 'Content-Type: application/json' \
--data '{
"name": "Test Environment Name 6",
"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]}
]
}'
import requests
import json
url = "https://api.ddosify.com/v1/environment/"
payload = json.dumps({
"name": "Test Environment Name 6",
"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
]
}
]
})
headers = {
'X-API-KEY': '<API_KEY>',
'Content-Type': 'application/json'
}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.text)
cURL
Python
curl --location 'https://api.ddosify.com/v1/testdata/' \
--header 'X-API-KEY: <API_KEY>' \
--form 'name="medals222"' \
--form 'file=@"/Users/test/medals.csv"' \
--form 'type="csv"' \
--form 'file_config="{
\"delimiter\": \";\",
\"vars\": {
\"0\": {
\"tag\": \"year\"
},
\"1\": {
\"tag\": \"city\"
},
\"2\": {
\"tag\": \"sport\"
},
\"5\": {
\"tag\": \"event\"
},
\"7\": {
\"tag\": \"medal\"
},
\"8\": {
\"tag\": \"no\"
}
},
\"allow_quota\": true,
\"order\": \"random\",
\"skip_first_line\": true,
\"skip_empty_line\": true
}"'
import requests
url = "https://api.ddosify.com/v1/testdata/"
payload={'name': 'medals222',
'type': 'csv',
'file_config': '{
"delimiter": ";",
"vars": {
"0": {
"tag": "year"
},
"1": {
"tag": "city"
},
"2": {
"tag": "sport"
},
"5": {
"tag": "event"
},
"7": {
"tag": "medal"
},
"8": {
"tag": "no"
}
},
"allow_quota": true,
"order": "random",
"skip_first_line": true,
"skip_empty_line": true
}'}
files=[
('file',('medals.csv',open('/Users/test/medals.csv','rb'),'text/csv'))
]
headers = {
'X-API-KEY': '<API_KEY>'
}
response = requests.request("POST", url, headers=headers, data=payload, files=files)
print(response.text)
{
"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
}
}
This load testing result shows the performance of a web application under load testing. The result is presented in JSON format and has
two
steps, each with two
locations: DE
and US
.The
summary
section gives an overview of the test results, which includes the success and fail count, response times, iteration count, and status code distribution for each step and location. The location_dist
section shows the response times for each location, and the response_times
section shows the average, maximum, minimum, and percentile response times for each step and location.In general, the load testing result indicates that the web application's performance varies significantly across locations. Because the target server is located in Frankfurt (Germany), the response times in the US are generally higher than in DE, which indicates that the application is slower for users in the US. The
status_code_dist
shows that all requests in the test returned a status code of 405 in step 1 and 200 in step 2.The
test_url
gives the Ddosify Cloud test URL for detailed reporting using charts and tables. 
Ddosify Cloud Test Report
Last modified 8mo ago