Retrieving and Updating an issue's status via the rest API

Samuel Kwok
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
March 5, 2019

Hello,

I want to retrieve, and update the execution status of a Test Execution in JIRA using REST API.  My Jira and Xray are hosting in Jira Cloud.

Could you point me to a working example how to do that.  I am looking at https://developer.atlassian.com/cloud/jira/platform/rest/v2/

I am using POSTMAN to compose and send the Request to mydomain.atlassian.net.

There are 14 Passed, 1 Failed in the Test Execution  (TEST-key123)

1. I can only do a GET https://mydomain.atlassian.net/rest/api/3/TEST-Key123   with Status:200K

2. I can not filter the status=FAILED.  The response is the same at item 1.  Is this filter correct?

GET https://mydomain.atlassian.net/rest/api/3/TEST-Key123?filter=status=FAILED

3. How can I do a POST to update the status of the FAILED to move it back to TODO.

POST https://mydomain.atlassian.net/rest/api/3/TEST-Key123  

 

Helps are greatly appreciate.

Thanks

Sam

2 answers

0 votes
Doug Swartz
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 5, 2019

For your "can't filter": Get Issue is not used to get a list of issues.  You will need to do a "Get Issue Picker Suggestions" request with the JQL or filter information. This returns a list of issue IDs. Then issue the Get issue on each issue.

Statuses are different from other fields. To change a status, you need to issue send a Transition Issue message.

Jenkins Auto March 6, 2019

Hi Doug, 

I used JQL which lets me filter out just the FAILED ones. Correct me if I am wrong, JQL seems to just do query, but not update. 

But I still can not figure out how to change a status for my Test Execution. 

Would you point me to any examples to do the update using JQL.

Thanks again

Sam.

Like # people like this
0 votes
Marty
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
March 5, 2019

Hi Sam,

I am not on the Jira Team, but I will try to help.

I suspect that you need to url encode the filter query, so something like 

https://mydomain.atlassian.net/rest/api/3/TEST-Key123?filter=status%3DFAILED

I hope that helps!

Jenkins Auto March 6, 2019

Thanks Martyn. When I copy the URL to the Browser from POSTMAN, it will add the URL encoding. 

I can only retrieve my issue (Type: Test Execution) as a whole. But the filter part still does not work.   I used JQL which lets me filter out just the FAILED ones.

Like Marty likes this

Suggest an answer

Log in or Sign up to answer