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

This widget could not be displayed.

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.

This widget could not be displayed.


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



This widget could not be displayed.

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.

This widget could not be displayed.

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 ?

This widget could not be displayed.

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:


This widget could not be displayed.

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
Atlassian Summit 2018

Meet the community IRL

Atlassian Summit is an excellent opportunity for in-person support, training, and networking.

Learn more
Community showcase
Posted Wednesday in New to Jira

Are you planning to trial, or are currently trialling Jira Software? - We want to talk to you!

Hello! I'm Rayen, a product manager at Atlassian. My team and I are working hard to improve the trial experience for Jira Software Cloud. We are interested in   talking to 20 people planning t...

229 views 3 0
Join discussion

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