It's all about the answers!

Ask a question

Upload Attachment to a test artifact with RQM Url Utility (REST API)


Rakel Alvarez (613) | asked Apr 24 '15, 4:27 a.m.
Hello everyone,

I'm using RQM Url Utility for uploading an attachment to RQM 5.0. I've successfully uploaded it using the followinfg command:
java -jar RQMUrlUtility.jar -command POST -user xx -password xx -filepath C:\xx.jpg -url https://xxx:9443/qm/service/com.ibm.rqm.integration.service.IIntegrationService/resources/<project_alias>/attachment

Since the attachment is not associated with test case or test script ID, there is no way I can see this attachment using the UI. So I tried to associate with a test script or test case but not successfull result was obtained.
I tried this commands:

java -jar RQMUrlUtility.jar -command POST -user xx -password xx -filepath C:\xx.jpg -url https://xxx:9443/qm/service/com.ibm.rqm.integration.service.IIntegrationService/resources/<project_alias>/attachment/urn:com.ibm.rqm:testcase:51

java -jar RQMUrlUtility.jar -command PUT -user xx -password xx -filepath C:\xx.jpg -url https://xxx:9443/qm/service/com.ibm.rqm.integration.service.IIntegrationService/resources/<project_alias>/attachment/urn:com.ibm.rqm:testcase:51

java -jar RQMUrlUtility.jar -command POST -user xx -password xx -filepath C:\xx.jpg -url https://xxx:9443/qm/service/com.ibm.rqm.integration.service.IIntegrationService/resources/<project_alias>/testcase/urn:com.ibm.rqm:testcase:51

java -jar RQMUrlUtility.jar -command PUT-user xx -password xx -filepath C:\xx.jpg -url https://xxx:9443/qm/service/com.ibm.rqm.integration.service.IIntegrationService/resources/<project_alias>/testcase/urn:com.ibm.rqm:testcase:51

Thanks in advance,
Rakel

One answer



permanent link
Donald Nong (14.5k614) | answered Apr 27 '15, 2:05 a.m.
I don't think you can do it with one step only. Check the following posts for some ideas.
https://jazz.net/forum/questions/170994/rqm-uploading-attachment-via-rest-apirqmurlutility
https://jazz.net/forum/questions/161897/how-to-add-an-attachment-to-a-test-result-from-the-command-line
Basically, you need to use POST first to upload/create an attachment, GET the URI of the new attachment, and then PUT the test artifact to include the attachment URI.
Note that with RQMUrlUtility 5.0.x, the new attachment will get a "proper" ID such as "urn:com.ibm.rqm:attachment:30", instead of the "slug" ID as for older versions. It appears that RQMUrlUtility no longer displays this ID in the command output, so you need to do a GET against the attachment feed to find out the URI of the new attachment.

Comments
Rakel Alvarez commented Apr 28 '15, 3:06 a.m. | edited Apr 28 '15, 3:14 a.m.

I'm using Rational Quality Manager and RQMUrlUtility 5.0 and the attachment gets a "slug" ID. Is it possible to PUT the test artifact to include the attachment URI with that slug ID?
 
I using the next URL but does not work:

https://xxx:9443/qm/service/com.ibm.rqm.integration.service.IIntegrationService/resources/<project_alias>/testscript/slug__U0NLsO2FEeSp-6dQNzBpqQ

Thank you


Donald Nong commented Apr 29 '15, 1:47 a.m.

If you got this "slug" ID when uploading an attachment, of course it would not work as you were using the ID to find a "testscript" rather than an attachment. You should have the attachment as

Then you need to prepare an XML file for the testscript as the payload of the PUT (modify/update) operation, and you add the attachment URL as a member in the XML file. Just do a GET operation against an existing test script with attachments to see what it should look like.


Rakel Alvarez commented May 11 '15, 6:34 a.m. | edited May 11 '15, 6:34 a.m.

This works for RQM 5.0. Know I'm doing some proves with RQM 5.0.2 and RQMUrlUtility 5.0.2 but I'm getting a "slug" ID also, instead of a "proper" ID such as "urn:com.ibm.rqm:attachment:30" in the response header, Content_Location.

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.