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

The Xray REST API provides the following endpoints.

# Test Execution Tests

- To view the Tests associated with a Test Execution, you need to specify the key of the Test Execution you want to view.
- To associate or remove a Test from a Test Execution, 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 have to be Test keys.
- To remove a Test from a Test Execution, you need to specify the key of the Test you wish to remove.


> Macro (rw-ui-expands-macro)
> 
> > Macro (rw-expand)
> 
> Return a json with a list of the test associated with the test execution. Note that this endpoint may be paginated.
> 
> ### ** **<span style="color: #003366">**Request**</span>** **
> 
> ###### ** **<span style="color: #003366">**PATH **</span><span style="color: #003366">**PARAMETERS**</span>
> 
> | **parameter** | **type** | **description** |
> | --- | --- | --- |
> | `testExecKey` | *String* | - key of the test execution. |
> 
> ###### **QUERY **<span style="color: #003366">**PARAMETERS**</span>
> 
> | **parameter** | **type** | **description** |
> | --- | --- | --- |
> | `detailed` | *boolean* | - if true will display detailed information about the testrun |
> | `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 beretuned. Should be greater or equal to 1. |
> 
> > ✅ **Example Request**
> > ✅ 
> > ✅ <span style="color: #000000">curl -H "Content-Type: application/json" -X GET -u admin:admin </span>[<span style="color: #000000">http://yourserver/rest/raven/1.0/api/testexec/TEST-123/test</span>](http://yourserver/rest/raven/1.0/api/testexec/TEST-123/test)<span style="color: #000000"> </span>
> > ✅ 
> > ✅ <span style="color: #000000">curl -H "Content-Type: application/json" -X GET -u admin:admin </span>[<span style="color: #000000">http://yourserver/rest/raven/1.0/api/testexec/TEST-123/test?detailed=true</span>](http://yourserver/rest/raven/1.0/api/testexec/TEST-123/test?detailed=true)
> 
> ### <span style="color: #003366">**Responses**</span>** **
> 
> 200 OK : **text/plain** : Successful. Return a json.
> 
> 
> ##### **Example Output**
> 
> ```
> [
>    {
>       "id":204,
>       "key":"CALC-10",
>       "rank":1,
>       "status":"FAIL"
>    },
>    {
>       "id":205,
>       "key":"CALC-44",
>       "rank":2,
>       "status":"FAIL"
>    },
>    {
>       "id":326,
>       "key":"CALC-66",
>       "rank":3,
>       "status":"TODO"
>    },
>    {
>       "id":380,
>       "key":"CALC-42",
>       "rank":4,
>       "status":"TODO"
>    }
> ]
> ```
> 
> ##### **Example Output**
> 
> ```
> [
>    {
>       "id":204,
>       "status":"FAIL"
> 	  "assignee":"admin",
> 	  "executedBy":"admin",
>       "startedOn":"Friday 10:13 AM",
>       "finishedOn":"Friday 10:13 AM",
>       "defects":[  
>          {  
>             "id":10607,
>             "key":"PER-71",
>             "summary":"1234",
>             "status":"Open"
>          }
>       ],
>       "evidences":[  
>          {  
>             "id":25,
>             "fileName":"stepsDATA.csv",
>             "fileSize":"0,1 kB",
>             "created":"Friday 10:16 AM",
>             "author":"admin",
>             "fileURL":"http://localhost:5980/testJira/plugins/servlet/raven/attachment/25/stepsDATA.csv"
>          }
>       ],
>       "key":"PER-46",
>       "rank":1
>    },
>    {
>       "id":60,
>       "status":"FAIL",
>       "executedBy":"admin",
>       "startedOn":"Friday 10:13 AM",
>       "finishedOn":"Friday 10:13 AM",
>       "defects":[  
>       ],
>       "evidences":[  
>       ],
>       "key":"PER-41",
>       "rank":2
>    },
>    {  
>       "id":61,
>       "status":"ABORTED",
>       "executedBy":"blake",
>       "startedOn":"Friday 10:13 AM",
>       "finishedOn":"Friday 10:13 AM",
>       "defects":[  
>       ],
>       "evidences":[  
>       ],
>       "key":"PER-33",
>       "rank":3
>    }
> ]
> ```
> 
> 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 execution. Return error messages, if there are any.
> 
> ### ** **<span style="color: #003366">**Request**</span>** **
> 
> ###### ** **<span style="color: #003366">**PATH **</span><span style="color: #003366">**PARAMETERS**</span>
> 
> | **parameter** | **type** | **description** |
> | --- | --- | --- |
> | `testExecKey` | *String* | - key of the test execution. |
> 
> ##### **Example Input**
> 
> ```
> {
>     "add": [
>         "CALC-33",
>         "CALC-75"
>     ],
>     "remove": [
>         "CALC-25",
>         "CALC-45"
>     ]
> }
> ```
> 
> > ✅ **Example Request**
> > ✅ 
> > ✅ <span style="color: #000000">curl -H "Content-Type: application/json" -X POST -u admin:admin --data @example.json </span>[<span style="color: #000000">http://yourserver</span>](http://yourserver)<span style="color: #000000">/</span><span style="color: #000000">rest/raven/1.0/api/testexec/TEST-123/test </span>
> 
> <span style="color: #003366">**Responses**</span>** **
> 
> 200 OK : **text/plain** : Successful. Return error messages, if there are any.
> 
> 
> ##### **Example Output**
> 
> ```
> ["Issue with key CALC-99 not found or is not of type Test or 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 execution.
> 
> ### ** **<span style="color: #003366">**Request**</span>** **
> 
> ###### ** **<span style="color: #003366">**PATH **</span><span style="color: #003366">**PARAMETERS**</span>** **
> 
> | **parameter** | **type** | **description** |
> | --- | --- | --- |
> | `testExecKey` | *String* | - key of the test execution. |
> | testKey | *String* | - key of the test. |
> 
> > ✅ **Example Request**
> > ✅ 
> > ✅ <span style="color: #000000">curl -H "Content-Type: application/json" -X DELETE -u admin:admin </span>[<span style="color: #000000">http://yourserver</span>](http://yourserver)<span style="color: #000000">/</span><span style="color: #000000">rest/raven/1.0/api/testexec/TEST-123/test/TEST-321 </span>
> 
> ###### <span style="color: #003366">**Responses**</span>** **
> 
> 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.