How to import test execution results using REST API and XRay for JIRA


I am trying to import test execution results for my project but am having difficulty associating tests with the test execution using the REST API. I have tried to emulate the instructions found at but it does not seem to be working. I can import a test execution without any associated tests.

Here is my request which I am posting to http://<URL>//rest/api/2/issue

"{""fields"": {""project"":{""key"": ""ET""}, ""summary"": ""Test execution"", ""description"":""Description"", ""issuetype"":{""id"":""10302""}, ""tests"":[{""testKey"" : ""ET-879"",""comment"" : ""Successful execution"",""status"" : ""PASS""},{""testKey"" : ""ET-880"",""comment"" : ""Execution failed"",""status"" : ""FAIL""},{""testKey"" : ""ET-881"",""comment"" : ""Successful execution"",""status"" : ""PASS""}]}}"

The "tests" field is not recognised, but I can't find the appropriate replacement to get this to work.

Any help you can give would be appreciated.



6 answers

1 accepted

2 votes
Accepted answer

Hi Jamie,

You must use the REST path specific to Xray: /rest/raven/1.0/import/execution

The JSON you are using is for the default REST service of JIRA. This will just create a Test Execution issue. 

If you follow the instructions on, it should be able to import the execution results by creating a new Test Execution issue, if you specify the "info" element (this will create a Test Execution issue in the same project where the Test issues are but we will soon release a new version where you can specify the project explicitly). You can update an existing test Execution if, instead of the "info" element you pass the "testExecutionKey":

Have you already tried this REST path? Did you get an error?


Bruno Conde.


Yes that was the first thing I tried, I've tried it again though and am still seeing problems. I'm now sending to http://<URL>/rest/raven/1.0/import/execution

My request is now

"{"info" : {"summary" : "Test execution trial","description" : "Blah"},"tests" : [{"testKey" : "ET-880","comment" : "Successful execution","status" : "PASS"},{"testKey" : "ET-881","comment" : "Successful execution","status" : "PASS"},{"testKey" : "ET-883","comment" : "Failed execution","status" : "FAIL"}]}"

But the response I am receiving is (HTML tags removed)

HTTP Status 406 - Not Acceptable
Not Acceptable
The resource identified by this request is only capable of generating responses with characteristics not acceptable according to the request "accept" headers

As it appears that the issue is possibly with my "Accept" header I am also sending this

setRequestHeader "Accept", "application/json"

Please can you let me know if this is correct?

To be honest I'm new to Jira, XRAY, JSON and REST smile

Thanks for your help



Ok it seems that removing the setRequestHeader is actually working now. Thank you for your help Bruno.

Great. I was just about to send you an example by using curl: curl -H "Content-Type: application/json" -X POST -u admin:admin --data @data.json http://yourserver/rest/raven/1.0/import/execution where the "data.json" is your JSON file.

I am looking for the steps to Import Test cases to XRay Jira using REST API. I am looking for the JSON format I have to use to do the import. Can u help ?

Hi Bruno, Jamie,

I'm using XRAY for JIRA and I'm trying to import a JSON result via Import interface on Test Execution issue.
I've got some questions:

1) How can I import a cucumber JSON format? I've browsed online help and so on and I found that I should be able to export the JSON formatting it properly. But it doesn't work. I have a lot of unhandled exceptions without any possibility to understand what's wrong (java.lang.exceptions)

2) If I convert the test automatic results to XRAY JSON format, I can successfully upload them but I cannot see the EXAMPLES results (I've raised a request about it:


Is it possible to integrate selenium webdriver tests (in BDD style) with XRAY and Bamboo? Or is it only for cucumber test?

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Jan 08, 2019 in Jira

How to Jira for designers

I’m a designer on the Jira team. For a long time, I’ve fielded questions from other designers about how they should be using Jira Software with their design team. I’ve also heard feedback from other ...

1,124 views 4 9
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you