Testsigma provides a robust API to manage the Executions and Execution Data using RESTful API Calls. Below given are some of the utilities provided by Testsigma API.

Note: We need to make sure the API request is authenticated. Otherwise, it may return a 401 Unauthorized Error as response.


1. Starting the Execution (POST)

Request URLhttps://app.testsigma.com/rest/execution/<execution-id>/run
Request HeaderContent-type: application/json
Request BodyNo Additional Body Content required
Expected Response<Run_ID>


cURL command Format:

curl -X POST -H 'Content-type: application/json' -u <Username>:<Password> https://app.testsigma.com/rest/execution/<execution-id>/run


Note: Replace <Username> and <Password> with your real credentials and the <execution-id> part with actual execution-id.

For more details, refer the article - Start/Trigger an execution in Testsigma using REST API


2. Uploading APK/IPA/Attachment files to Testsigma Uploads (POST)

Request URLhttps://app.testsigma.com/rest/storage/upload
Request HeaderContent-Type:multipart/form-data
Request Bodyapp=<Select the key type as 'file' and select the file from the local machine>

data={"name": "<app_name>","type": "<file_type>","version": "<version_name>","project": "<Project_name>"};type = application/json
Expected Response<App_ID>


cURL command Format:

curl -u "<Username>:<Password>" -X POST https://app.testsigma.com/rest/storage/upload -H "Content-Type=multipart/form-data" -F "app=@</path/to/the/apkfile.apk>" -F 'data={
"name": "<app_name>",
"type": "<file_type>",
"version": "<version_name>",
"project": "<Project_name>"
};
type = application/json'


Note: Replace <Username> and <Password> with your real credentials and the <app_name>, <version_name>, and <Project_name> parts with corresponding details.

For more details, refer the article - Uploading files to Testsigma Uploads using REST API


3. Get Global Parameters (GET)

Request URLhttps://app.testsigma.com/rest/globalparamters/<id>
Request HeaderNo Additional Headers required
Request BodyNo Additional Body Content required
Expected Response
{
    "id": <GlobalParameterID>,
    "createdBy": <userID>,
    "createdDate": <DatefromEpoch>,
    "updatedBy": <userID>,
    "updatedDate": <DatefromEpoch>,
    "active": 1,
    "name": "Production URLs",
    "description": "Production URLs for google.com",
    "globalParams": "{\"base_url\":\"https://in.qa.milliman.com\",\"base_url2\":\"https://us.milliman.com\"}",
    "projectId": <ProjectID>
}


cURL command Format:

curl -X GET -H 'Content-type: application/json' -u <Username>:<Password> https://app.testsigma.com/rest/globalparamters/<id>


Note: Replace <Username> and <Password> with your real credentials and the <execution-id> part with actual execution-id.


4. Update Global Parameters (POST)

Request URL

https://app.testsigma.com/rest/globalparamters/<id>/param

Request HeaderNo Additional Headers required
Request Body{"<parameter1>":"<value1>"}

If the Global Parameter set already contains a parameter with the name 'parameter1', the value will be updated to 'value1'.
If the Global Parameter set doesn't contain the given parameter, it will be created in the Global Parameter Set.
Expected ResponseBlank


cURL command Format:

curl -X POST -H 'Content-type: application/json' -u <Username>:<Password> https://app.testsigma.com/rest/execution/<execution-id>/run


Note: Replace <Username> and <Password> with your real credentials and the <execution-id> part with actual execution-id.


Overwrite Existing Parameter Value Example:

For example, let the existing Global Parameter be as given below.

Existing Global Parameter Set:

{
    "staging_url":"https://www.google.com",
    "staging_url_login":"https://www.google.com/signin"
}

It contains two parameters 'staging_url' and 'staging_url_login'.


We need to update the value for 'staging_url_login' and add a new parameter 'staging_url_logout' as well. The REST API Body Content given below does the task.

Body Content for Update Parameter API:

{
    "staging_url_login":"https://www.google.com/login",
    "staging_url_logout":"https://www.google.com/logout"
}


Final Global Parameter Set:

{
    "staging_url":"https://www.google.com",
    "staging_url_login":"https://www.google.com/login",
    "staging_url_logout":"https://www.google.com/logout"
}