Jira REST request 'rest/api/2/status' returns duplicates with the same names and different IDs.

Grygorii_sh July 20, 2021

Jira REST request
https://<domain>.atlassian.net/rest/api/2/status
returns duplicates with the same names and different IDs, e.g.:

{
"self": "https://<domain>.atlassian.net/rest/api/2/status/10401",
"description": "This was auto-generated by Jira Service Management during workflow import",
"iconUrl": "https://<domain>.atlassian.net/images/icons/statuses/generic.png",
"name": "Declined",
"untranslatedName": "Declined",
"id": "10401",
"statusCategory": {
"self": "https://<domain>.atlassian.net/rest/api/2/statuscategory/3",
"id": 3,
"key": "done",
"colorName": "green",
"name": "Done"
}
},

{
"self": "https://<domain>.atlassian.net/rest/api/2/status/10384",
"description": "This was auto-generated by Jira Service Management during workflow import",
"iconUrl": "https://<domain>.atlassian.net/images/icons/statuses/generic.png",
"name": "Declined",
"untranslatedName": "Declined",
"id": "10384",
"statusCategory": {
"self": "https://<domain>.atlassian.net/rest/api/2/statuscategory/3",
"id": 3,
"key": "done",
"colorName": "green",
"name": "Done"
}
},

although in the browser I can see only one 'Declined' with ID:10401.

The question: If it is OK when how can I filter REST response?

1 answer

1 accepted

0 votes
Answer accepted
Bill Sheboy
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.
July 20, 2021

Hi @Grygorii_sh  -- Welcome to the Atlassian Community!

There can be different status values with the same name and different ID values; this impact has increased with the addition of team-managed projects, where every project has its own copies of the status values.

One approach would be to use a different REST API method to get the status values by project to narrow the scope:

https://docs.atlassian.com/software/jira/docs/api/REST/1000.824.0/#api/2/project-getAllStatuses

Best regards,
Bill

Grygorii_sh July 20, 2021

Hi @Bill Sheboy 

But in the browser in the 'Advanced Issue Search' along with Filter 'All Projects' I can see only one 'Declined' with ID:10401.

Is it configured in Jira which exactly statuses can be displayed? Or is this the default behavior and field 'Declined' contains both IDs 10384 and 10401?

Bill Sheboy
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.
July 20, 2021

Short answer: I do not know and I suspect "no".  JQL is not a SQL.

My understanding is that when you search status by name, it matches anything that matches...which is why filters, boards, and dashboard gadgets can have problems when team-managed projects are used within an instance...when the filter is not specific enough.

If your filter narrows the scope (such as project=myProject AND...) that will limit which status values are returned.  You can also solve this by explicitly searching by the status ID: status = 10401

Suggest an answer

Log in or Sign up to answer