Plans & Pricing Help API Docs SendGrid Labs
Menu

API Docs

POST /v2/tests

Create a new test. Refer to the test creation page for details about each field.

Example #

Before creating a test in the API, we have to create and verify an app using the API. Use the domain from the URL(s) you want to test as the app name and verify it before trying this example.

curl -X POST https://api.loader.io/v2/tests \
     -H 'loaderio-auth: API_KEY' \
     --data-binary '{"test_type":"cycling",
              "total": 6000,
              "duration":60,
              "urls": [
                {"url": "http://gonnacrushya.com"}
              ]}' \
     -H 'Content-Type: application/json'

Example result (successful test creation):

{
    "message": "success",
    "result_id": "08627345e5aa0f89f95851a69a4cb0dc",
    "status": "running",
    "test_id": "f133e9e3691e405eefd3e1b7c351cb18"
}

Options #

An asterisk (*) indicates required fields.

Parameter Type Default Example/Values Description
*test_type string none "cycling" or "non-cycling" Test type
*urls Array none (see url options) URLs to test
*duration number none 60 Duration of test, in seconds
*initial number 0 Number of connections to start with (ignored for non-cycling tests)
*total number 60 Number of connections to end with, or total number of connections for non-cycling tests
timeout number 10000 10000 Timeout value, in milliseconds
error_threshold number 50 50 Error percentage threshold
callback URL http://gcrshya.com/loader A URL to POST results to when the test finishes
callback_email email address team@gonnacrushya.com Email address to send results to
scheduled_at datetime 2013-5-15 3:30:00 Schedule the test to run sometime in the future
name text First URL "GonnaCrushYa Homepage"
notes text "Server: ec2-micro"

URL Options #

Each member of the urls array is an object with the following attributes:

Parameter Type Default Example/Values Description
*url string none URL to test
request_type string "GET" "GET" or "POST" Type of request
credentials JSON {"login": "admin", "password": "secret"} HTTP Basic Auth credentials
headers JSON {"Content-Type": "application/json"} Headers to send to this URL
request_params JSON {"name": "Steve"} Data to send in query string or POST body
raw_post_body text "name=Steve" Raw data to use as POST body in request
payload_file_url URL http://gonnacrushya.com/payload.json URL of a payload file
variables JSON [{"name": "token", "property": "X-Custom-Token", "source": "header"}, ...] Define variables whose values will be set to header value