Jazz Forum Welcome to the Jazz Community Forum Connect and collaborate with IBM Engineering experts and users

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

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.

0 votes



6 answers

Permanent link
 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

0 votes


Permanent link
 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.

0 votes


Permanent link
  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

0 votes

Comments

 (sorry for the formatting)


Permanent link
Hi, Eric,

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


Daniel.

0 votes


Permanent link
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.

0 votes

Comments

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

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

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":[]}}

0 votes

Your answer

Register or log in 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.

Search context
Follow this question

By Email: 

Once you sign in you will be able to subscribe for any updates here.

By RSS:

Answers
Answers and Comments
Question details
× 10,936
× 201

Question asked: Mar 25 '14, 8:42 a.m.

Question was seen: 7,223 times

Last updated: Dec 05 '17, 12:19 a.m.

Confirmation Cancel Confirm