Getting ID of newly created test case using POST method
Hi,
When I create new test case using POST method, is there any way to get the ID of newly created test case ?
Currently I am using RQMUrlUtility.jar and it gives output URL after post which does not contain test case ID:
ex: https://server:9443/qm/service/com.ibm.rqm.integration.service.IIntegrationService/resources/TestProject/testcase
which does not have ID..
When I create new test case using POST method, is there any way to get the ID of newly created test case ?
Currently I am using RQMUrlUtility.jar and it gives output URL after post which does not contain test case ID:
ex: https://server:9443/qm/service/com.ibm.rqm.integration.service.IIntegrationService/resources/TestProject/testcase
which does not have ID..
Accepted answer
You can do a GET again using the externalId generated
e.g. GET https://localhost:9443/jazz/service/com.ibm.rqm.integration.service.IIntegrationService/resources/Quality Manager/testcase/slug__G0QpcSibEeKeLMV6FKvWKw
with header
accept: application/xml
The response should contain the XML of the artifact. In the xml you can look for webId, that is the internal integer Id of the artifact created.
e.g. GET https://localhost:9443/jazz/service/com.ibm.rqm.integration.service.IIntegrationService/resources/Quality Manager/testcase/slug__G0QpcSibEeKeLMV6FKvWKw
with header
accept: application/xml
The response should contain the XML of the artifact. In the xml you can look for webId, that is the internal integer Id of the artifact created.
Comments
Correct.
Note, the webId property is only supported for a subset (roughly half) of resources.
One other answer
You would have to use another HTTP client that displays HTTP response headers since the resource ID is contained in the Content-Location header.
Comments
It returns Generated ID something like this slug1SgOcSiQEeKeLMV6FKvWKw
I want RQM generated numeric ID. I am not sure if we can use this slug1SgOcSiQEeKeLMV6FKvWKw for getting XML content of resource. Please suggest.
This is the generated external ID. It can be the ID of the URL used to GET the resource XML.