How to get UUID of RQM attachment via api?
I am creating a java script that uploads attachments to rqm via the rest api they links them to a test result via a hyperlink in the Result Details section.
However I don't want the attachments to download when the link is clicked just open in a new tab. Whenever I make the hyperlink point to the slug url i.e. (https://server/qm/service/com.ibm.rqm.integration.service.IIntegrationService/resources/_joxs8Aq1Ee6FEOrz8syiKw/attachment/slug__OlO_IBaREe6L3J8gDdaoJg) or (https://server/qm/service/com.ibm.rqm.integration.service.IIntegrationService/resources/_joxs8Aq1Ee6FEOrz8syiKw/attachment/urn:com.ibm.rqm:attachment:71) returned from the POST request it downloads instead of opening in a new window.
If I manually paste the link from the attachments page i.e. (https://server/qm/service/com.ibm.rqm.planning.service.internal.rest.IAttachmentRestService/_OlYwIBaREe6L3J8gDdaoJg) then it does open in a new tab without downloading. I can't seem to access this id programmatically so I can add the link to the test result without it downloading automatically.
One answer
It is pretty obvious, that the links are for two totally different services. The link from the attachments page belongs to an internal API - as you can see from the internal in service/com.ibm.rqm.planning.service.internal.rest.IAttachmentRestService
To get the UUID of any object would require to do a GET, using the URI provided by the POST (likely in the location header). Then find the UUID e.g. in the URI of the element.
How the link you get behaves is a completely different question and it would be up to you to implement a behavior you want as well.
Comments
When I do a GET it looks like below is it not possible to get the uuid from the POST url
<ns2:projectArea href="link" alias="RQM+Test+Project"/>
<ns4:identifier>url/urn:com.ibm.rqm:attachment:77</ns4:identifier>
<ns2:webId>77</ns2:webId>
<ns4:title> name.pdf</ns4:title>
<ns2:creationDate>2023-06-29T15:25:49.986Z</ns2:creationDate>
<ns4:creator name="Roger L" ns1:resource="https://server/jts/resource/itemName/com.ibm.team.repository.Contributor/rogerl">rogerl</ns4:creator>
<ns2:fileSize>38.31</ns2:fileSize>
<ns6:updated>2023-06-29T15:25:49.986Z</ns6:updated>