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?
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
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?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.