Testsigma provides a robust API to manage and trigger the Executions using RESTful API Calls. These can be used to integrate with any of the third-party CI tools available in the industry such as GitLab, Codeship, CircleCI e.t.c.


Start Execution

We can start execution in Testsigma easily using the following API request and replacing the <execution-id> part with actual execution-id

http://app.testsigma.com/rest/execution/<execution-id>/run

For a particular Execution, you can get the complete API request(that uses cURL command) to trigger the execution from the Executions page as shown below:

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


And here's the Powershell script(equivalent for the above cURL command):

$base64AuthInfo = [Convert]::ToBase64String([Text.Encoding]::ASCII.GetBytes(("{0}:{1}" -f '<Username>','<Password>')))

Invoke-RestMethod -Method POST -Headers @{Authorization=("Basic {0}" -f $base64AuthInfo)} -ContentType "application/json" -uri "https://app.testsigma.com/rest/execution/1247/run"

As you can see, the execution ID in the above cases is '1247'. You just need to replace the <Username> and <Password> part.


The Environment Run Id is returned in the response for the request if the execution was started successfully.

 

Making the API Call using POSTMAN

Now let us see how to create the same request in PostMan REST API Client with Basic Authentication:

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


In most of the modern clients like Postman, you might have the option to select Basic Authentication and enter the username, password in the provided input fields. Simply select the Basic Auth option from the Authorization Tab and click on Update Request to include the Basic Authentication header.


You may also manually create a Base64 encoded Authentication Header field as shown below:

The Environment Run Id is returned in the response for the request if the execution was started successfully.