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
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
Comments
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.
Note, https://jazz.net/wiki/bin/view/Main/RqmApi#ResourcesFootnote6.