Simulation API

Run a template

POST https://nsim.iotify.io/api/test/:testID/run

This endpoint allows you to run a test with the required run settings.

Path Parameters

NameTypeDescription

testID*

The ID of the test that needs to run

Headers

NameTypeDescription

Content-Type*

application/json

key*

API token for the account

domain*

The domain under which your account exists

Request Body

NameTypeDescription

runSettings*

Object

Defines the parameters for the simulation

jobName*

Unique name identifying the currently running job

rS: clients*

Number

Total number of clients

rS: iteration*

Number

Total number of iterations

rs: interval*

Number

Interval between two iterations

rS: captureLogs

Boolean

Capture all the log data to display on the results page

rS: captureState

Boolean

Capture all the state data to display on the results page

rS: capturePayload

Boolean

Capture all the payload data to display on the results page

{
    "success": true,
    "jobId": "$jobID",
    "jobName": "$jobName"
}

The parameters marked as rS: $parameter are parameters under the runSettings object.

For a list of all additional runSettings parameter you can use, check the Run Settings page of the documentation.

// Example curl command

curl -X POST -H "Accept: application/json" -H "Content-Type: application/json" -H "key:$KEY" -H "domain:nsim.iotify.io" -d '{"jobName":"$JOBNAME","runSettings":{"interval":1000,"iteration":150,"clients":10}}' nsim.iotify.io/api/test/$TESTID/run

Get Job Status

GET https://nsim.iotify.io/api/jobs/:workspaceID/:jobID

This API returns the status and results of the simulation job

Query Parameters

NameTypeDescription

workspaceID*

WorkspaceID for the workspace you're a part of

jobID*

Simulation ID as seen in the UI or returned by API while launching the simulation through the POST API.

Headers

NameTypeDescription

Accept*

application/json

Content-Type*

String

application/json

key*

String

API token for the account

domain*

String

The domain under which your account exists

{
    "jobId": "$jobID",
    "testId": "$testID",
    "jobName": "$jobName",
    "workspaceId": "$workspaceID",
    "submitterId": "$submitterID",
    "runSettings": {
        "name": "Default",
        "interval": 1000,
        "iteration": 150,
        "clients": 10,
        "totalClients": 5,
        "clientIdOffset": 0
    },
    "currentInstance": 0,
    "results": {
        "result": {
            "total": 750,
            "success": 750,
            "failure": 0,
            "startAt": 1667282175065.829,
            "endAt": 1667282327070.1438,
            "duration": 152004.31469726562,
            "status": "finished",
            "eta": 0
        },
        "instances": {
            "0": {
                "result": {
                    "total": 750,
                    "success": 750,
                    "failure": 0,
                    "startAt": 1667282175065.829,
                    "endAt": 1667282327070.1438,
                    "duration": 152004.31469726562,
                    "status": "finished",
                    "eta": 0
                },
                "iterations": {
                    "0": {
                        "result": {
                            "total": 5,
                            "success": 5,
                            "failure": 0,
                            "startAt": 1667282175065.829,
                            "endAt": 1667282177692.3975,
                            "duration": 2626.568359375,
                            "status": "finished",
                            "eta": 0
                        }
                    },
                    
                    .............
                    
                    "149": {
                        "result": {
                            "total": 5,
                            "success": 5,
                            "failure": 0,
                            "startAt": 1667282327068.5632,
                            "endAt": 1667282327070.1438,
                            "duration": 1.58056640625,
                            "status": "finished",
                            "eta": 0
                        }
                    }
                }
            }
        }
    }
}
// Example curl command

curl -X GET -H "Accept: application/json" -H "Content-Type: application/json" -H "key:$KEY" -H "domain:nsim.iotify.io" nsim.iotify.io/api/jobs/$WORKSPACE/$JOB

Last updated