It's all about the answers!

Ask a question

REST API @href Syntax Error

Gabor Federics (34718) | asked Dec 12 '16, 11:55 a.m.
Hi All

I try to execute a query to get all the test execution results from a test plan.
According to
the syntax of my query seems to be OK:

java.exe -jar RQMUrlUtility.jar -command GET -user <user> -password <pwd> -filepath output.xml -url https://<server>/qm/service/<project>/executionresult?fields=feed/entry/content/executionresult/(*|testplan[@href='https://<server>/qm/service/<project>/testplan/'])

I'm receiving an error saying that "testplan[@href" is incorrect.

I also tried to re-use the example from the Wiki:
<feedUrl>?fields=feed/entry/content/testplan[title='test plan title']/(*|testcase[@href=' <resourceUrl>'])
and got the same error "testcase[@href" incorrect .

Could you please help me out with this issue?
I'm using RQMUrlUtil-6.0.2. Due to our IT security settings I could not test with HTTP-Requester

Thanks a lot in advance

Accepted answer

permanent link
Donald Nong (14.5k614) | answered Dec 13 '16, 1:10 a.m.
You made it sound like there is something wrong with the REST API syntax, but it is not. I have to run it myself to understand what you tried to say. The error is (when running on Windows)
'testplan[@href' is not recognized as an internal or external command, operable program or batch file.
This is because the command shell takes the pipe sign (|) and believes the part after it is another command, hence the complain. To resolve it, you need to quote the entire URL string.  As you are using single quotes within the URL, you can simply use double quotes to surround the URL. If you use double quotes within the URL, you need to escape them (use \" to replace ") first.

Gabor Federics selected this answer as the correct answer

Gabor Federics commented Dec 13 '16, 4:36 a.m.

Ohh, that was a dumm mistake, I didn't think about it

Thanks for your help Donald!

Donald Nong commented Dec 13 '16, 7:21 p.m.

Well, not dumb really. It can happen to anybody, anytime. :-)

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.