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
Update target
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.

Example with all parameters
curl -X POST -d '{
"name": "Target name",
"description": "Target description",
"group": ["Group A", "Group B"],
"public": false,
"build_consolidation": false,
"build_replacement": false
}'
-H "Content-Type: application/json"
-H "Authorization: Bearer token"
https://www.tesults.com/api/targets

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: 6
NameValue
nameName of the new target.
description (optional)A description of the new target. Useful for providing additional information about the target.
group (optional)Set target group. Pass through an array of strings containing group names, a target can belong to multiple groups. Must contain at least one group.
public (optional)Set true to set privacy to public and false for private for the target. If set to public this only takes effect if both the organization and project are also set to public by an administrator.
build_consolidation (optional)Set true if want to enable build consolidation for this target.
build_replacement (optional)Set true if want to enable build replacement for this 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.

 

Update target

Update target properties.

Request example using curl ('token' to be replaced with API token and ':target' to be replaced with target id)
curl -X POST -d '{"name": "New target name"}'
-H "Content-Type: application/json"
-H "Authorization: Bearer token"
https://www.tesults.com/api/targets/:target
Example with all parameters
curl -X POST -d '{
"name": "Target name",
"description": "Target description",
"group": ["Group A", "Group B"],
"public": false,
"build_consolidation": false,
"build_replacement": false
}'
-H "Content-Type: application/json"
-H "Authorization: Bearer token"
https://www.tesults.com/api/targets/:target

Endpoint

https://www.tesults.com/api/targets/:target
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: 6
NameValue
name (optional)Name of the target.
description (optional)A description of the target. Useful for providing additional information about the target.
group (optional)Set target group. Pass through an array of strings containing group names, a target can belong to multiple groups. . Must contain at least one group.
public (optional)Set true to set privacy to public and false for private for the target. If set to public this only takes effect if both the organization and project are also set to public by an administrator.
build_consolidation (optional)Set true if want to enable build consolidation for this target.
build_replacement (optional)Set true if want to enable build replacement for this target.

Response

Successful response:

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

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 updated target.

 

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.