It's all about the answers!

Ask a question

How can I run a stored query with input parameter with REST api?


Michele Pegoraro (1.8k12107100) | asked Mar 22 '16, 11:39 a.m.
edited Mar 22 '16, 11:41 a.m.
Hi,
I was trying to call a stored query through REST api. I can call the query correctly using the following url:

https://server:port/ccm/oslc/queries/__pHxUOUGEeWuMokBR-rR4w/rtc_cm:results

with __pHxUOUGEeWuMokBR-rR4w that is the uuid of the query.

But what if I want to call a query that requires an input parameter? how can I add it to the url?

If I don't put the parameter I have this error:
<oslc_cm:error><oslc_cm:status>500</oslc_cm:status><oslc_cm:message>Cannot run query with unbound parameters for variable(s): 'summary21'</oslc_cm:message></oslc_cm:error>

How can I pass summary21 parameter?

Thanks,
Michele.

Accepted answer


permanent link
Donald Nong (14.4k213) | answered Mar 27 '16, 8:27 p.m.
Many folks asked the same question in various ways and the answer appeared to the same - you cannot do it.
https://jazz.net/forum/questions/171754/how-to-pass-condition-value-to-a-query-prompt-through-the-url
https://jazz.net/forum/questions/177625/can-we-bind-parameters-to-rtc-query
https://jazz.net/forum/questions/146701/how-to-use-parametrized-queries-in-plain-java-api

Note that the ability to use stored queries is considered as "preliminary support", and may not get any further enhancement on top of what is described in the Wiki. Also, it may not be obvious - this feature requires OSLC 1.0. In other words, it may have been deprecated already given that we usually work with OSLC 2.0 now.
https://jazz.net/wiki/bin/view/Main/ResourceOrientedWorkItemAPIv2#Using_Stored_Queries
Michele Pegoraro selected this answer as the correct answer

Comments
Michele Pegoraro commented May 03 '16, 4:35 a.m.

Thank you.

2 other answers



permanent link
Kohji Ohsawa (595118) | answered Mar 24 '16, 9:37 p.m.
JAZZ DEVELOPER
Hi Michele, 

I am not sure what the "summary21" is, but have you tried OSLC query parameters?
http://open-services.net/bin/view/Main/OSLCCoreSpecQuery#Query_Parameters

permanent link
Ranjit Singh (11) | answered Nov 01 '16, 1:28 p.m.
Hi Michele Pegoraro

Were you able to pass the parameters?Because I am also getting the same issues.

Your answer


Register or to post your answer.