It's all about the answers!

Ask a question

rqm REST API: get all testphase with a title name is not working


Sanj Ratnam (112) | asked Aug 11 '22, 8:42 a.m.

 Hello all,



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!


Comments
Ian Barnard commented Aug 11 '22, 9:58 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

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. 


Sanj Ratnam commented Aug 11 '22, 1:28 p.m.

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

3 answers



permanent link
David Honey (1.8k17) | 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?
For example, is there a query capability for test phases?


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



David Honey commented Aug 12 '22, 4:37 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

permanent link
Sanj Ratnam (112) | answered Aug 11 '22, 3:29 p.m.
I've found out that the filter is not working due to the # character. 
Does not work:

This works:

The query works only for nomal characters. Does someone have an idea how i can make it work for special characters like "#"? 

permanent link
David Honey (1.8k17) | answered Aug 12 '22, 4:42 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
edited Aug 12 '22, 4:42 a.m.

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

David Honey commented Aug 12 '22, 7:23 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
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 '='.

David Honey commented Aug 12 '22, 7:31 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

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.

If you try the proper URI, you see the URL encoded fields parameter value extracted in full. Applications should perform URL decoding of such values. If they do not, that's a defect in that application.



Sanj Ratnam commented Aug 12 '22, 11:00 a.m. | edited Aug 12 '22, 11:04 a.m.
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"]


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. 

David Honey commented Aug 12 '22, 11:13 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

I recommend submitting a defect against ETM.

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.