How to create a testscript with an image using the REST API
6 answers
Rich text sections (e.g. test script manual step) contain references to attachments for attachments (Insert Attachment) and images (Insert Image). You would use the RQM Reportable REST API to PUT the attachment and add the following attachments to your XHTML:
<a href=/<context>/web/dojo/../../service/com.ibm.rqm.planning.service.internal.rest.IAttachmentRestService/<UUID>>
<img src=/<context>/web/dojo/../../service/com.ibm.rqm.planning.service.internal.rest.IAttachmentRestService/<UUID>>
See https://jazz.net/wiki/bin/view/Main/RqmApi#Resources_and_their_Supported_Op (footnote 6).
<a href=/<context>/web/dojo/../../service/com.ibm.rqm.planning.service.internal.rest.IAttachmentRestService/<UUID>>
<img src=/<context>/web/dojo/../../service/com.ibm.rqm.planning.service.internal.rest.IAttachmentRestService/<UUID>>
See https://jazz.net/wiki/bin/view/Main/RqmApi#Resources_and_their_Supported_Op (footnote 6).
I have tried this but without success.
What exactly is the UUID? Doing a GET on an existing testscript it shows something like "_FUvR4SWZEeG0hKM5A2CkKQ".
But the attachment feed gives me a id like this:
"https://xibmratio.bmsw.bitmarck.org:9443/qm/service/com.ibm.rqm.integration.service.IIntegrationService/resources/iskv_21c+%28Qualit%C3%A4tsmanagement%29/attachment/urn:com.ibm.rqm:attachment:3"
What exactly is the UUID? Doing a GET on an existing testscript it shows something like "_FUvR4SWZEeG0hKM5A2CkKQ".
But the attachment feed gives me a id like this:
"https://xibmratio.bmsw.bitmarck.org:9443/qm/service/com.ibm.rqm.integration.service.IIntegrationService/resources/iskv_21c+%28Qualit%C3%A4tsmanagement%29/attachment/urn:com.ibm.rqm:attachment:3"
Both IDs are correct. There are several types of IDs in RQM for different usage, you could refer to https://jazz.net/wiki/bin/view/Main/RqmApi#id .
I have tried this but without success.
What exactly is the UUID? Doing a GET on an existing testscript it shows something like "_FUvR4SWZEeG0hKM5A2CkKQ".
But the attachment feed gives me a id like this:
"https://xibmratio.bmsw.bitmarck.org:9443/qm/service/com.ibm.rqm.integration.service.IIntegrationService/resources/iskv_21c+%28Qualit%C3%A4tsmanagement%29/attachment/urn:com.ibm.rqm:attachment:3"
What do I miss? The first xml with the UUID works, the second does not when using the internal IDs.
<?xml version="1.0" encoding="UTF-8"?>
<testscript xmlns="http://jazz.net/xmlns/alm/qm/v0.1/" xmlns:ns10="http://jazz.net/xmlns/alm/qm/v0.1/executionworkitem/v0.1" xmlns:ns11="http://jazz.net/xmlns/alm/qm/qmadapter/task/v0.1" xmlns:ns12="http://jazz.net/xmlns/alm/qm/qmadapter/v0.1" xmlns:ns2="http://schema.ibm.com/vega/2008/" xmlns:ns3="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:ns4="http://purl.org/dc/elements/1.1/" xmlns:ns5="http://jazz.net/xmlns/alm/v0.1/" xmlns:ns6="http://jazz.net/xmlns/alm/qm/v0.1/testscript/v0.1/" xmlns:ns7="http://jazz.net/xmlns/alm/qm/v0.1/executionresult/v0.1" xmlns:ns8="http://jazz.net/xmlns/alm/qm/v0.1/tsl/v0.1/" xmlns:ns9="http://jazz.net/xmlns/alm/qm/v0.1/catalog/v0.1">
<ns4:title>test9</ns4:title>
<scripttype>Manual</scripttype>
<variables/>
<steps><ns6:step ns2:id="_akrHs10uEeGtbtUdPkY3MQ" type="execution">
<ns6:name>MyName</ns6:name>
<ns6:title>MyTitle</ns6:title>
<ns6:description>
<div><p>image:<a href="/qm/web/dojo/../../service/com.ibm.rqm.planning.service.internal.rest.IAttachmentRestService/_qe3Tgl0uEeGtbtUdPkY3MQ">
<img alt="face-smile.png" src="/qm/web/dojo/../../service/com.ibm.rqm.planning.service.internal.rest.IAttachmentRestService/_qe3Tgl0uEeGtbtUdPkY3MQ" /></a> </p></div>
</ns6:description>
</ns6:step>
</steps></testscript>
<?xml version="1.0" encoding="UTF-8"?>
<testscript xmlns="http://jazz.net/xmlns/alm/qm/v0.1/" xmlns:ns10="http://jazz.net/xmlns/alm/qm/v0.1/executionworkitem/v0.1" xmlns:ns11="http://jazz.net/xmlns/alm/qm/qmadapter/task/v0.1" xmlns:ns12="http://jazz.net/xmlns/alm/qm/qmadapter/v0.1" xmlns:ns2="http://schema.ibm.com/vega/2008/" xmlns:ns3="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:ns4="http://purl.org/dc/elements/1.1/" xmlns:ns5="http://jazz.net/xmlns/alm/v0.1/" xmlns:ns6="http://jazz.net/xmlns/alm/qm/v0.1/testscript/v0.1/" xmlns:ns7="http://jazz.net/xmlns/alm/qm/v0.1/executionresult/v0.1" xmlns:ns8="http://jazz.net/xmlns/alm/qm/v0.1/tsl/v0.1/" xmlns:ns9="http://jazz.net/xmlns/alm/qm/v0.1/catalog/v0.1">
<ns4:title>test10</ns4:title>
<scripttype>Manual</scripttype>
<variables/>
<steps><ns6:step ns2:id="_akrHs10uEeGtbtUdPkY3MQ" type="execution">
<ns6:name>MyName</ns6:name>
<ns6:title>MyTitle</ns6:title>
<ns6:description>
<div><p>image:<a href="/qm/web/dojo/../../service/com.ibm.rqm.planning.service.internal.rest.IAttachmentRestService/urn:com.ibm.rqm:attachment:117">
<img alt="face-smile.png" src="/qm/web/dojo/../../service/com.ibm.rqm.planning.service.internal.rest.IAttachmentRestService/urn:com.ibm.rqm:attachment:117" /></a> </p></div>
</ns6:description>
</ns6:step>
</steps></testscript>
The following has worked. Is this correct usage?
<?xml version="1.0" encoding="UTF-8"?>
<testscript xmlns="http://jazz.net/xmlns/alm/qm/v0.1/" xmlns:ns10="http://jazz.net/xmlns/alm/qm/v0.1/executionworkitem/v0.1" xmlns:ns11="http://jazz.net/xmlns/alm/qm/qmadapter/task/v0.1" xmlns:ns12="http://jazz.net/xmlns/alm/qm/qmadapter/v0.1" xmlns:ns2="http://schema.ibm.com/vega/2008/" xmlns:ns3="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:ns4="http://purl.org/dc/elements/1.1/" xmlns:ns5="http://jazz.net/xmlns/alm/v0.1/" xmlns:ns6="http://jazz.net/xmlns/alm/qm/v0.1/testscript/v0.1/" xmlns:ns7="http://jazz.net/xmlns/alm/qm/v0.1/executionresult/v0.1" xmlns:ns8="http://jazz.net/xmlns/alm/qm/v0.1/tsl/v0.1/" xmlns:ns9="http://jazz.net/xmlns/alm/qm/v0.1/catalog/v0.1">
<ns4:title>test144</ns4:title>
<scripttype>Manual</scripttype>
<variables/>
<steps><ns6:step ns2:id="_akrHs10uEeGtbtUdPkY3MQ" type="execution">
<ns6:name>MyName</ns6:name>
<ns6:title>MyTitle</ns6:title>
<ns6:description>
<div><p>image:<a href="https://demovmqm:9443/qm/service/com.ibm.rqm.integration.service.IIntegrationService/resources/HybridSUV-QM/attachment/urn:com.ibm.rqm:attachment:350">
<img alt="face-smile.png" src="https://demovmqm:9443/qm/service/com.ibm.rqm.integration.service.IIntegrationService/resources/HybridSUV-QM/attachment/urn:com.ibm.rqm:attachment:350" /></a> </p></div>
</ns6:description>
</ns6:step>
</steps></testscript>