Welcome to the Jazz Community Forum
How to filter work item by state name using Reportable REST API

How to filter work item by state name using Reportable REST API
So far, I have only been able to filter by the State id:
Is there different syntax I can use to query by State name? If not, once the States are defined for a work item type, will the id's always be static at that point?
Accepted answer

Comments

Thanks. It's wierd that it lets you filter on state name if you do the filtering at the next lowest level on state. I guess we'll just stick with the ID then.

Hi Alanna,
This works for me:
fields=workitem/workItem[projectArea/name='development' and type/id='defect' and state/id='bugzillaWorkflow.state.s9']/(id|summary|state/name)
but some state id's are in the form of 's2', 's3' etc
so if I try to run the below query for 's2':
fields=workitem/workItem[projectArea/name='development' and type/id='defect' and state/id='s2']/(id|summary|state/name)
It gives me a link to the next 100 but doesn't display any results. Any idea why? or how to resolve this?
Thanks,
Binoy

Binoy, for those 's' ids, use just the number: state/id='2'.
1 vote

Unbelievable! WOW! Thanks so much. Not sure why I didn't think of it. :)
Comments
Michael Taylor
Jun 24 '13, 1:21 p.m.The question field is playing havok with my URL formatting:
So far, I have only been able to filter by the State id:
https:// <server>:<port>/ccm/rpt/repository/workitem?fields=workitem/workItem[state/name='Approved']/(id|state/name)
Is there different syntax I can use to query by State name? If not, once the States are defined for a work item type, will the id's always be static at that point?
Michael Taylor
Jun 24 '13, 1:22 p.m.The following gives an error "CRRED8022E: Non Queryable Field: state/name":
Michael Taylor
Jun 24 '13, 1:23 p.m.Trying to list the URL again:
Michael Taylor
Jun 24 '13, 1:26 p.m.This is what doesn't work:
partial URL: fields=workitem/workItem[state/name='Approved']/(id|state/name)