How can I run a stored query with input parameter with REST api?
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.
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
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
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