Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

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

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

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?

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
TAGS

Community Events

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

Find an event

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

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you