LoadNinja REST API (or LoadNinja API) is used for accessing LoadNinja data and for integration with external systems. It is available to all LoadNinja customers.
Swagger UI
The API has a web interface that contains and describes all the available API operations and parameters, and allows you to make API calls and view the returned data.
To access the API web interface, go to:
https://app.swaggerhub.com/apis-docs/smartbear/loadninja/1.0
Keep in mind that the web interface accesses and changes real-world data.
Base URL and scheme
To access the API from external tools and utilities, use the following base URL:
The LoadNinja API uses HTTPS as the transfer protocol (scheme).
Authorization
Data format headers
LoadNinja API operations use the JSON data format for request bodies.
To provide the server with the correct information about the body format, append the following header to the requests that have a body:
Since most operations also return JSON data, please add the Accept
header to your requests as well:
Response codes
LoadNinja API uses the following status codes for responses:
Status code | Description |
---|---|
200 | The request was completed successfully. LoadNinja sent the expected response. |
400 | The request is missing the authorization header, or the authorization key is invalid. |
500 | The request was not processed due to an internal error. For example, the client tried to access a non-existing resource, or used a wrong HTTP method. |
Note: An error response may contain additional information on the error within the request body.
Response format
When you use LoadNinja API for your tests, the response format depends on the size of the test. For small and medium-sized tests, the format is raw JSON. However, for more complex tests or when dealing with a larger number of users - where the size of the data transferred exceeds 6MB (as limited by AWS Lambda) - the JSON data is compressed.
The response is returned in JSON, but the endpoint /test-run/{test-run-id}/raw-stats
is an exception. Its response is compressed, so it must be decompressed.
To decompress data, you need:
-
Node.js installed (version 14 or higher)
-
Decompression script (click here to view the file)
Note: This script is developed and maintained by the LoadNinja team. It uses one dependency - JsZip.
After installing Node, follow these steps:
-
Open Command Line Interface (CLI).
-
Navigate to the folder that containing the decompression script using the cd command.
-
In the CLI, write:
node extract_test_data.js <json_file_with_compressed_data> <extracted_json_file>
Make sure to replace
<json_file_with_compressed_data>
with the actual name of your compressed JSON file and<extracted_json_file>
with the desired name for the decompressed file. -
Click Enter. The script will decompress the data and place it in the specified
<extracted_json_file>
.