How to get id for new created test result by using REST API through RQMUrlUtility?
Hi Someone who may concern,
We are working on CLM 6.0.4.
We used the RQMUrlUtility to upload our test case result to REST API as
<website>/qm/service/com.ibm.rqm.integration.service.IIntegrationService/resources/<project name>/executionresult/?
And we can upload them properly.
However, we want to know the id of test case result created by using this way. We want to know the id because we want to create link between defect and test case result ( failed ones)automatically by sending http command to rest API of RTC to update the related defect.
But when I checked the response from RQMUrlUtility, it only said
RQMUrlUtility: Server Response code: 201
RQMUrlUtility: [ SUCCESS ] File : "xxx.xml" successfully posted to URL :
"https:<local site>:9443/qm/service/com.ibm.rqm.integration.service.IIntegrat
ionService/resources/<local site>/executionresult/? "
Disconnecting from the IBM Rational Quality Manager server.
So we are wondering whether we could add some options in our request to get id just created?
Thanks!
Best regards,
Jane Zhou
Accepted answer
Hi Jane,
If you're using a PUT request with an external ID, you already know the ID. Otherwise, POST requests return the generated ID in the Content-Location response header (see https://jazz.net/wiki/bin/view/Main/RqmApi#HTTP_Responses). Unfortunately, this header is not exposed by the RQM URL Utility. Alternatively, if you know the web ID of the test artifact, you could use the internal ID (see https://jazz.net/wiki/bin/view/Main/RqmApi#Internal_ID). Finally, you could query for the test artifact using the one it's properties and the fields filtering support (see https://jazz.net/wiki/bin/view/Main/RqmApi#fields).
For the types of IDs supported, see https://jazz.net/wiki/bin/view/Main/RqmApi#id.
I would suggest using a HTTP client (see https://jazz.net/wiki/bin/view/Main/RqmApi#Common_Usage_Scenarios) instead of the RQM URL Utility.