It's all about the answers!

Ask a question

How to filter work item by state name using Reportable REST API


Michael Taylor (8865764) | asked Jun 24 '13, 1:19 p.m.

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?


Comments
Michael Taylor commented 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 commented Jun 24 '13, 1:22 p.m.

The following gives an error "CRRED8022E: Non Queryable Field: state/name":

  


Michael Taylor commented Jun 24 '13, 1:22 p.m. | edited Jun 24 '13, 1:23 p.m.

 Trying to list the URL again: 

  


Michael Taylor commented Jun 24 '13, 1:23 p.m. | edited Jun 24 '13, 1:26 p.m.

    This is what doesn't work:

partial URL: fields=workitem/workItem[state/name='Approved']/(id|state/name)
 

Accepted answer


permanent link
Alanna Zito (1.3k3) | answered Jun 24 '13, 1:50 p.m.
JAZZ DEVELOPER
As the error message says, state/name is not queryable, so you can't filter on it.  The state IDs are static, so you could filter on that instead.
Michael Taylor selected this answer as the correct answer

Comments
Michael Taylor commented Jun 24 '13, 1:54 p.m.

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.


Binoy D'costa commented May 05 '15, 3:40 p.m.

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


1
Greg Pflaum commented May 05 '15, 10:26 p.m.

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


Binoy D'costa commented May 07 '15, 2:49 p.m.

Unbelievable! WOW! Thanks so much. Not sure why I didn't think of it. :)

Your answer


Register or to post your answer.


Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.