rqm REST API: get all testphase with a title name is not working
Hello all,
i'm currently trying to get all the testphases with a specific title name. my query url looks like this:
https://baseurl/qm/service/com.ibm.rqm.integration.service.IIntegrationService/resources/project/testphase?fields=feed/entry/content/testphase[title="ABC40_TT#433"]
Unfortunately it gets me not only the testphases with the title="ABC40_TT#433". There a lot of testphases with other title names. Can someone help me? :)
Thanks! |
3 answers
David Honey (1.8k●1●7)
| answered Aug 11 '22, 8:57 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER That URI looks like an ETM reportable rest API. Have you looked at using OSLC Query?
Comments
Sanj Ratnam
commented Aug 11 '22, 1:23 p.m.
Thanks for the quick reply. What do you mean exactly with query capability for testphases? We are currently only using rest api queries. I think as Ian Barnard mentioned, maybe the filter is not set up correctly. But i'm doing it exactly as it is described in the documentation. This is a example from the documentation: <feedUrl>?fields=feed/entry/content/testplan[title='test plan title']/description |
I've found out that the filter is not working due to the # character.
Does not work:
https://baseurl/qm/service/com.ibm.rqm.integration.service.IIntegrationService/resources/project/testphase?fields=feed/entry/content/testphase[title="ABC40_TT#433"]
This works:
The query works only for nomal characters. Does someone have an idea how i can make it work for special characters like "#"?
|
David Honey (1.8k●1●7)
| answered Aug 12 '22, 4:42 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER edited Aug 12 '22, 4:42 a.m. Have you tried URL encoding the query parameter values in the request URI?
In general, all HTTP query parameter values should be URL encoded.
For example, instead of: https://baseurl/qm/service/com.ibm.rqm.integration.service.IIntegrationService/resources/project/testphase?fields=feed/entry/content/testphase[title="ABC40_TT#433"]
Encoding the fields query parameter value would give:
https://baseurl/qm/service/com.ibm.rqm.integration.service.IIntegrationService/resources/project/testphase?fields=feed%2Fentry%2Fcontent%2Ftestphase%5Btitle%3D%22ABC40_TT%23433%22%5D Comments
Sanj Ratnam
commented Aug 12 '22, 6:56 a.m.
Thanks for the reply. I have encoded the fields query parameter like you described it, but then i got a 400 bad request error.
Then i added one more "#" to the title string like this: [title="ABC40_TT##433"]. I've encoded the url again and somehow i've got all the testphases with the titlename ABC40_TT#433. This means if we have a value which contains one "#", then the get request will probably fail. I think we need to send the request with doubles hashs.This means:
To get testphases with title=ABC40_TT#433 we need to send a url encoded query with title=ABC40_TT##433.
What do you think? I'm not sure about it
All query parameter values in an HTTP reqeust should be URL encoded. This applies to all HTTP requests. If the REST service you are calling cannot process this, I would regard that as a defect in that REST service.
Remember that it is the parameter values that should be encoded, not the parameter name and '='.
You can also try free online tools like https://www.freeformatter.com/url-parser-query-string-splitter.html and https://url-decode.com/tool/url-parser and try your original URI. If you do that, you see that the #433 is taken as the hash fragment and is not part of the query parameter value. That's because the URI was not correctly formed by URL encoding the parameter value.
The parameter values are encoded.
i have encoded this part: fields=feed/entry/content/testphase[title="ABC40_TT#433"]
The encoded url looks extactly like the one you mentioned in your answer above:
This throws me an 400 error.
Then i added an extra "#" to the title and encoded it: fields=feed/entry/content/testphase[title="ABC40_TT##433"]
The encoded url looks like this:
https://baseurl/qm/service/com.ibm.rqm.integration.service.IIntegrationService/resources/project/testphase?fields=feed%2Fentry%2Fcontent%2Ftestphase%5Btitle%3D%22ABC40_TT%23%23433%22%5D
This is getting me all the testphases with the titlename ABC40_TT#433. Thats confusing for me, cause I was expecting this from the first mentioned encoded url.
I recommend submitting a defect against ETM.
|
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.
Comments
IME the ETM reportable rest filters like you're trying seem to return everything when the filter is malformed - however I don't have a better suggestion for you to try, excep ttry dcterms:title instead of tite. Or search the forum for an example reportable rest call that works then work from there.
This is a example from the documentation: <feedUrl>?fields=feed/entry/content/testplan[title='test plan title']/description
my query looks similar. I've tried it also with dcterms:title, unfortunately it does also not work.