---
title: "Test Sets - REST"
canonical: "https://docs.getxray.app/space/XRAY/301474143/Test%20Sets%20-%20REST"
format: markdown
---
You can manage (i.e., create, update, delete) Test Sets directly through the [Jira's native REST API](https://docs.atlassian.com/jira/REST/latest/).

The Xray REST API provides the following endpoints.

# Test Set Tests

- To view the Test associated with a Test Set, you need to specify the key of the Test Set you wish to view.
- To associate or remove a Test from a Test Set, you need to send a JSON with a list of the keys. When associating, these keys can be Test keys or Test Set keys; when removing, they can only be Test keys.
- To remove a Test from a Test Set, you need to specify the key of the Test you wish to remove. It is also possible to remove all Tests from the Test Set.


> Macro (rw-ui-expands-macro)
> 
> > Macro (rw-expand)
> 
> ### **Request**
> 
> ###### **PATH PARAMETERS**
> 
> | parameter | type | description |
> | --- | --- | --- |
> | `testSetKey` | *String* | - key of the test set. |
> 
> ###### **QUERY PARAMETERS**
> 
> | parameter | type | description |
> | --- | --- | --- |
> | `limit` | *Integer* | - limits the number of results per page. Should be greater or equal to 0 and lower or equal to the maximum set in the Global Configuration. |
> | `page` | *Integer* | -number of the page to be retuned. Should be greater or equal to 1. |
> | testDefinition | *boolean *(default: true) | -true, if you want to get the Test and Pre Conditions definitions; false otherwise. Beware that setting this flag to false may speed-up the response times. |
> 
> > ✅ **Example Request**
> > ✅ 
> > ✅ curl -H "Content-Type: application/json" -X GET -u admin:admin [http://yourserver/rest/raven/1.0/api/testset/TEST-123/test](http://yourserver/rest/raven/1.0/api/testset/TEST-123/test)
> 
> ### Responses
> 
> 200 OK : **text/plain** : Successful. Returns a JSON object.
> 
> 
> The "rank" and "key" will clearly identify the Test and its order within the Test Set. Note that the output may currently return other fields, which may only be available ina explicitlydetailed request in a future release.
> 
> |  |
> | --- |
> | ```
> [
>    {
>       "id":13602,
>       "rank":1,
>       "key":"CALC-44",
>       "self": "http://jiraserver/rest/api/2/issue/10401"
>    },
>    {
>       "id":13600,
>       "rank":2,
>       "key":"CALC-42",
>       "self": "http://jiraserver/rest/api/2/issue/10402"
>    },
>    {
>       "id":13886,
>       "rank":3,
>       "key":"CALC-66",
>       "self": "http://jiraserver/rest/api/2/issue/10403"
>    }
> ]
> ``` |
> 
> 400 BAD_REQUEST : **text/plain** : Returns the error.
> 
> 401 UNAUTHORIZED : **text/plain** : The Xray for JIRA license is not valid.
> 
> 500  INTERNAL SERVER ERROR : **text/plain** : An internal error occurred getting the tests.

> Macro (rw-ui-expands-macro)
> 
> > Macro (rw-expand)
> 
> Associate tests with the test set. Returns error messages, if there are any.
> 
> ### **Request**
> 
> ###### **PATH PARAMETERS**
> 
> | parameter | type | description |
> | --- | --- | --- |
> | `testSetKey` | *String* | - key of the test set. |
> 
> |  |
> | --- |
> | ```
> {
> 	"add": [
> 		"CALC-14",
> 		"CALC-29"
> 	],
> 	"remove": [
> 		"CALC-15",
> 		"CALC-50"
> 	]
> }
> ``` |
> 
> > ✅ **Example Request**
> > ✅ 
> > ✅ curl -H "Content-Type: application/json" -X POST -u admin:admin --data @example.json [http://yourserver](http://yourserver)/rest/raven/1.0/api/testset/TEST-123/test
> 
> **Responses**
> 
> 200 OK : **text/plain** : Successful. Returns error messages if there are any.
> 
> |  |
> | --- |
> | ```
> ["Test with key CALC-29 is already associated with this Test Set."]
> ``` |
> 
> 400 BAD_REQUEST : **text/plain** : Returns the error.
> 
> 401 UNAUTHORIZED : **text/plain** : The Xray for JIRA license is not valid.
> 
> 500  INTERNAL SERVER ERROR : **text/plain** : An internal error occurred associating the tests.


> Macro (rw-ui-expands-macro)
> 
> > Macro (rw-expand)
> 
> Remove test from the test set.
> 
> ### **Request**
> 
> ###### **PATH PARAMETERS**
> 
> | parameter | type | description |
> | --- | --- | --- |
> | `testSetKey` | *String* | - key of the test set. |
> | testKey | *String* | - key of the test. |
> 
> > ✅ **Example Request**
> > ✅ 
> > ✅ curl -H "Content-Type: application/json" -X DELETE -u admin:admin [http://yourserver](http://yourserver)/rest/raven/1.0/api/testset/TEST-123/test/TEST-321
> 
> ###### **Responses**
> 
> 200 OK : **text/plain** : Successful.
> 
> 400 BAD_REQUEST : **text/plain** : Returns the error.
> 
> 401 UNAUTHORIZED : **text/plain** : The Xray for JIRA license is not valid.
> 
> 500  INTERNAL SERVER ERROR : **text/plain** : An internal error occurred removing the test.