Tesults API Targets

If you are just getting started with Tesults and have not submitted test results data to Tesults yet and cannot see any results data in the results view, read the integration documentation instead. Once that has been completed, you can use the Tesults API to retrieve results data to make decisions within your continuous integration and deployment pipelines.

Targets

Retrieve targets
Create target
Regenerate target token
Delete target
 

Retrieve targets

Retrieving targets is useful for getting the id and names of all of the targets that belong to a project. When fetching results the id of the target to fetch results for is required.

Request example using curl ('token' to be replaced with API token)
curl https://www.tesults.com/api/targets
-H "Authorization: Bearer token"

Endpoint

https://www.tesults.com/api/targets
GET Method

Headers

The Authorization header is required for all requests to the Tesults API. See the authentication documentation for details.

Name
Authorization
Value
Bearer <token>

Parameters

Total: 2
NameValue
limit (optional)A number (minimum value 1) to limit the number of targets returned. If no limit is supplied the default limit is 100.
cursor (optional)Pagination parameter. If a cursor is returned in the response data from a request that means more data is available. Add the value of the cursor returned in the response in the next request to retrieve the next set of data.

Response

Successful response:

{
  "data": {
    "code": 200,
    "message": "Success",
    "targets": [
      {
        "id": <id>,
        "name": <name>,
        ...
      }
    ],
    "cursor": <cursor>
  }
}

Failure response:

{
  "error": {
    "code": 401,
    "message": "Unauthorized",
  }
}

Successful responses return JSON containing a data property. Error responses return JSON containing an error property. Both data and error values contain a code and message property, specifying the http status code and a message containing additional context.

Successful responses also contain additional properties within data. The response includes an array of targets and cursor for pagination use if there is additional data available (more targets) to retrieve.

 

Create target

Create a new target.

Request example using curl ('token' to be replaced with API token)
curl -X POST -d '{"name": "New target name"}'
-H "Content-Type: application/json"
-H "Authorization: Bearer token"
https://www.tesults.com/api/targets

Note that projects on the Free plan are limited to 5 targets in total and this limit cannot be increased. Projects on Standard and Plus plans are limited to 100 targets in total by default but you can have this limit raised, at no additional cost, by contacting help@tesults.com.

Endpoint

https://www.tesults.com/api/targets
POST Method

Headers

The Authorization header is required for all requests to the Tesults API. See the authentication documentation for details.

Name
Authorization
Value
Bearer <token>

Body

Total: 2
NameValue
nameName of the new target.
description (optional)A description of the new target. Useful for providing additional information about the target.

Response

Successful response:

{
  "data": {
    "code": 200,
    "message": "Success",
    "target": {
      "id": <id>,
      "name": <name>,
      ...
    },
    "token": <token>
  }
}

Failure response:

{
  "error": {
    "code": 401,
    "message": "Unauthorized",
  }
}

Successful responses return JSON containing a data property. Error responses return JSON containing an error property. Both data and error values contain a code and message property, specifying the http status code and a message containing additional context.

Successful responses also contain additional properties within data. The response includes the newly created target and the target token to use for uploading results data. This is the only time the token is transmitted so you must save it, if lost the token can be regenerated using the regeneration API.

 

Regenerate target token

Regenerate a target token. Tokens are required for uploading results data.

Request example using curl ('token' to be replaced with API token and ':target' to be replaced with target id)
curl -X POST
-H "Content-Type: application/json"
-H "Authorization: Bearer token"
https://www.tesults.com/api/
targets/:target/regenerate_token

Endpoint

https://www.tesults.com/api/targets/:target/regenerate_token
POST Method

Headers

The Authorization header is required for all requests to the Tesults API. See the authentication documentation for details.

Name
Authorization
Value
Bearer <token>

Path

Replace :target with the target id of the target for which to regenerate a token.

Parameters

Total: 0
NameValue

Response

Successful response:

{
  "data": {
    "code": 200,
    "message": "Success",
    "target": {
      "id": <id>,
      "name": <name>
      ...
    },
    "token": <token>
  }
}

Failure response:

{
  "error": {
    "code": 401,
    "message": "Unauthorized",
  }
}

Successful responses return JSON containing a data property. Error responses return JSON containing an error property. Both data and error values contain a code and message property, specifying the http status code and a message containing additional context.

Successful responses also contain additional properties within data. The response includes the target for which the token has been regenerated and the token itself.

 

Delete target

Delete a target including the test runs and all test case data for the target.

Request example using curl ('token' to be replaced with API token and ':target' to be replaced with target id)
curl -X DELETE
-H "Content-Type: application/json"
-H "Authorization: Bearer token"
https://www.tesults.com/api/targets/:target

Endpoint

https://www.tesults.com/api/targets/:target
DELETE Method

Headers

The Authorization header is required for all requests to the Tesults API. See the authentication documentation for details.

Name
Authorization
Value
Bearer <token>

Path

Replace :target with the target id of the target to be deleted.

Parameters

Total: 0
NameValue

Response

Successful response:

{
  "data": {
    "code": 200,
    "message": "Success",
  }
}

Failure response:

{
  "error": {
    "code": 401,
    "message": "Unauthorized",
  }
}

Successful responses return JSON containing a data property. Error responses return JSON containing an error property. Both data and error values contain a code and message property, specifying the http status code and a message containing additional context.