How to filter work item by state name using Reportable REST API
![](http://jazz.net/_images/myphoto/a48ec80e50c4a4d3c224fc4544492744.jpg)
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:
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?
Accepted answer
![](http://jazz.net/_images/myphoto/a48ec80e50c4a4d3c224fc4544492744.jpg)
Comments
![](http://jazz.net/_images/myphoto/a48ec80e50c4a4d3c224fc4544492744.jpg)
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.
![](http://jazz.net/_images/myphoto/bca861382ce117d709ab024cb35e0d05.jpg)
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
![](http://jazz.net/_images/myphoto/cd79a5baaaffa6a62df92efbc4d90e28.jpg)
Binoy, for those 's' ids, use just the number: state/id='2'.
1 vote
![](http://jazz.net/_images/myphoto/bca861382ce117d709ab024cb35e0d05.jpg)
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)