How to get the attachment id of an attachment uploaded using REST API
I have uploaded an attachment using RQMURL utility using command - java -jar RQMUrlUtility.jar -command POST -user <myid> -password <mypath> -filepath "C:\\Users\\libin\Desktop\\abcd.txt" -url "https://localhost:9443/qm/service/com.ibm.rqm.integration.service.IIntegrationService/resources/<project Area>/attachment/<user defined id>"
Attachment is uploaded successfully.But RQM has created a new id for the attachment and hence i am not able to link the attachment to my test case or test results.Is there any way to get the id assigned by RQM so that i can link it with execution results?
|
Accepted answer
Hi Libin,
I have followed the suggestion from Paul to issue the GET command in Poster: GET on https://localhost:9443/qm/service/com.ibm.rqm.integration.service.IIntegrationService/resources/RQMDemo/attachment It returns the new attachment id from above GET command: <entry xmlns="http://www.w3.org/2005/Atom"><id>https://localhost:9443/qm/service/com.ibm.rqm.integration.service.IIntegrationService/resources/RQMDemo/attachment/urn:com.ibm.rqm:attachment:31</id><updated>2015-09-21T14:36:27.141Z</updated><title type="text">jazz-mark.png</title><summary type="text">Attachments Section</summary><link href="https://localhost:9443/qm/service/com.ibm.rqm.integration.service.IIntegrationService/resources/RQMDemo/attachment/urn:com.ibm.rqm:attachment:31" rel="alternate" type="application/xml" title=""/> </entry> Hope this helps! Will libin sebastian selected this answer as the correct answer
Comments
libin sebastian
commented Sep 21 '15, 1:51 p.m.
Hi William,
Thanks for your update.I tried a GET using the below command -
java -jar RQMUrlUtility.jar -command GET -user <myid> -password <mypaswd> -filepath I:\Java\junk\ -url "https://localhost:9443/qm/service/com.ibm.rqm.integration.service.IIntegrationService/resources/Demo%20(Quality%20Management)/attachment"
i got the below response -
RQMUrlUtility: Connected to https://localhost:9443 using project "Demo+(Quality+
Management)"
RQMUrlUtility: Calling [ HTTP GET ] method to download an attachment
RQMUrlUtility: Server Response code: 200
RQMUrlUtility: Got an IOException: java.io.FileNotFoundException: I:\Java\junk\M
on, 21 Sep 2015 17:43:15 GMT (The filename, directory name, or volume label synt
ax is incorrect)
Directory I:\Java\junk\ is there in the system.Am i doing something wrong?
Looks like there is a 'M' appended to the file path:
Paul, the "M" is part of the timestamp "Mon, 21 Sep ...".
libin sebastian
commented Sep 22 '15, 10:56 a.m.
Thanks Donald.This is exactly what i was looking for.I am able to download the attachment without any issue.
I have uploaded a file to rqm using below command
java -jar RQMUrlUtility.jar -command PUT -user <myid> -password <mypaswd> -filepath "C:\Users\libin\Desktop\RQMxmls\out.txt" -url "https://localhost:9443/qm/service/com.ibm.rqm.integration.service.IIntegrationService/resources/Demo%20(Quality%20Management)/attachment/<unique id>"
i was able to download the same attachment using below command -
java -jar RQMUrlUtility.jar -command GET -user <myid> -password <mypaswd> -filepath "I:\Java\junk\abcd.txt" -url "https://localhost:9443/qm/service/com.ibm.rqm.integration.service.IIntegrationService/resources/Demo%20(Quality%20Management)/attachment/<unique id used in put command>"
Once again thanks to Donald & Paul for clarifying my doubts
|
One other answer
Yes, it's in the Content-Location response header (see https://jazz.net/wiki/bin/view/Main/RqmApi#HTTP_Responses). However, the RQM URL Utility does not return the response headers. You can use a PUT operation with your own external ID (see https://jazz.net/wiki/bin/view/Main/RqmApi#Create) or HTTP Requester/Poster (see https://jazz.net/wiki/bin/view/Main/RqmApi#Common_Usage_Scenarios).
Note, https://jazz.net/wiki/bin/view/Main/RqmApi#ResourcesFootnote6. Comments I tried with PUT command also.Still i am not able to refer the attachment with user defined id.
Used the below command -
java -jar RQMUrlUtility.jar -command PUT -user <myid> -password <mypath> -filepath "C:\Users\libin\Desktop\abcd.txt" -url "https://localhost:9443/qm/service/com.ibm.rqm.integration.service.IIntegrationService/resources/<project Area="">/attachment/<user defined="" id="">"
Can some one give more details on how to get the attachment id?
The attachment URL (-url value) should be a resource URL (see https://jazz.net/wiki/bin/view/Main/RqmApi#resourceUrl_for_interaction_with) with an ID (see https://jazz.net/wiki/bin/view/Main/RqmApi#id). The same URL should be used in the GET request. You can also resolve the attachment resource URL from the attachment feed (see https://jazz.net/wiki/bin/view/Main/RQMURLUtility#Command_Lines_Arguments_explaine).
|
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.