It's all about the answers!

Ask a question

Filtering workitems from saved query using GET, filterAttribute and filterValue parameters


Daniel Garcia (4911013) | asked Mar 25 '14, 8:42 a.m.
edited Mar 25 '14, 12:56 p.m.
Good morning.

My company is trying to merge some web applications, and one of the requisites is to be able to retrieve workitems with some custom filters, like type, internalState or relation with other workitems. To do so, we must provide an URL to RTC, so I'm planning to use a custom saved query which returns all the workitems by default. Then, I use the parameters "filterAttribute" and "filterValue" to get the elements I'm looking for, in the following way:

Workitem with ID = 139:
  • https://jazzserver:9443/ccm/web/projects/MyProjectArea#action=com.ibm.team.workitem.runSavedQuery&id=_SMOWoK3PEeO0x6KOcG5E-w&filterAttribute=id&filterValue=139

Workitems with "defect" type:
  • https://jazzserver:9443/ccm/web/projects/MyProjectArea#action=com.ibm.team.workitem.runSavedQuery&id=_SMOWoK3PEeO0x6KOcG5E-w&filterAttribute=workItemType&filterValue=defect

Workitems related with workitem which ID is 139:
  • https://jazzserver:9443/ccm/web/projects/MyProjectArea#action=com.ibm.team.workitem.runSavedQuery&id=_SMOWoK3PEeO0x6KOcG5E-w&filterAttribute=link:com.ibm.team.workitem.linktype.relatedworkitem:target/id&filterValue=139

I achieved applying these filters using filterAttribute and filterValue parameters, but just one by one (One request, one filter). Does anyone know if there's a way to combine the filters in just one request using GET instead POST method allowing to perform "AND" operations over the saved query?

Thank you very much for your help.

Kind regards,

    Daniel G. Garcia.

6 answers



permanent link
Eric Jodet (6.3k5111120) | answered Apr 01 '14, 9:00 a.m.
JAZZ DEVELOPER
 Hello Daniel,
you may use jsonParameterValues

Sample syntax:
&filterAttribute=<some_attribute_id>
&filterValue=<some_value>
&jsonParameterValues=
"resolutionDate":{"attributeId":"resolutionDate","operator":"after","values":["1388595600000"],
"internalState":{"attributeId":"internalState","operator":"is","values":["workflow.state.s5","workflow.state.s6"],
}

Hope it helps,
Eric

permanent link
Daniel Garcia (4911013) | answered Apr 01 '14, 12:09 p.m.
edited Apr 01 '14, 12:10 p.m.
 Hi, Eric,

First of all, thanks for answering. As far as I know, jsonParameterValues can only be sent through HTTP PUT/POST request. Unfortunately, I am only allowed to send a HTTP GET request. Do you know if there is any way to send jsonParameterValues using this method?

Again, thanks for your help.

Kind regards,

    Daniel.

permanent link
Eric Jodet (6.3k5111120) | answered Apr 01 '14, 12:54 p.m.
JAZZ DEVELOPER
  Hello Daniel,
well - when you run a query from a RTC Dashboard Work Item Statistics Viewlet,
we do a GET:
  1. Request URL:
    https://<host>:9443/ccm/service/com.ibm.team.workitem.common.internal.rest.IQueryRestService/getResultSet
to which we pass filterAttribute, filterValue and jsonParameterValues:

you may give it a try and check the request using Chrome and debugging tools.

Hope it helps,
Eric

Comments
Eric Jodet commented Apr 01 '14, 12:54 p.m.
JAZZ DEVELOPER

 (sorry for the formatting)


permanent link
Daniel Garcia (4911013) | answered Apr 02 '14, 3:19 a.m.
Hi, Eric,

I'll take a look, thank you very much for your help.


Daniel.

permanent link
Guenther Jornitz (5410) | answered Oct 01 '15, 2:15 p.m.
Hi Daniel / Eric, 
not sure what I'm doing wrong.... I'm using an existing query and try to select a number of value IDs.... I always get the following error:
   Error: com.ibm.team.repository.web.transport.ServiceRequest(): invalid requestParameters parameter: [object Object]

The request I'm using:
    https://swgjazz.ibm.com:8052/jazz/web/projects/Business%20Process%20Manager #action=com.ibm.team.workitem.runSavedQuery&id=_G5Pj8GTqEeW_a_znQFYvCQ&filterAttribute=id&jsonParameterValues={"id2":{"attributeId":"id","operator":"is","values":[200009,200010],"variables":[]}}&maxResults=50&projectAreaItemId=_xNY7cMzrEeCeP-edQ3dTlQ&startIndex=0

Any suggestion appreciated. Thx.

Comments
Donald Nong commented Oct 01 '15, 9:59 p.m.

Why does the jsonParameterValues contain a "null" value ("variables": [])?


Guenther Jornitz commented Oct 02 '15, 2:15 a.m.

Good point... I copied it from what I captured w/ firebug in another case.....
BUT: it makes no difference... even w/o this "null" value I  get the same error message.


permanent link
Donald Nong (14.5k614) | answered Dec 05 '17, 12:19 a.m.

Not sure whether I should put it as an answer or a comment somewhere, but here it goes.

I have verified that it still works in RTC 6.0.4. Two tips I will share here if anybody is going to do similar things.
1. Make sure that the saved query has the dynamic filter(s).
2. Add the query to the Work Item widget, capture the HTTP traffic to see what the "jsonParameters" parameter should be - it will be much easier than constructing it from scratch.

For reference, the URL that I have working looks like this (Marco's New Defects in my testing environment):
https://clm.jkebanking.net:9443/ccm/web/projects/JKE%20Banking%20(Change%20Management)#action=com.ibm.team.workitem.runSavedQuery&id=__gDG8NlZEeeI6JbiMe-jFQ&jsonParameterValues={"owner341":{"attributeId":"owner","operator":"is","values":["_cvHzANZWEeexRYuhIxDBSQ"],"variables":[]},"internalState351":{"attributeId":"internalState","operator":"is","values":["1"],"variables":[]}}

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.