Create a testcase using REST API
Hello,
I am currently developing a C++ program that makes import/export operations from/to RQM using REST API.
I have no problem with GET operations: I can retrieve a list of testcases from RQM and I implemented the feature of getting a subset of testcases rearranging them in an Excel document which reports, for each testcase, all its fields.
However, I'am not able to create a testcase (or a testplan) using HTTP POST/PUT. I read the testcase (or, in general, a testsuite) from an Excel document and, after a parsing, I store its information in a data structure. But when I send the HTTP POST (or PUT) request to RQM server, he replies with 400 (Bad Request) or 403 (Forbidden). I tried to send the testcase in a JSON-format and in a XML-format.
My HTTP POST Headers :
- ContentTypeHeader: application/xml (or application/json)
- Accept: application/xml (or application/json)
URL for Test Case : https://<RQMserver>/qm/service/com.ibm.rqm.integration.service.IIntegrationService/resources/<project-URI>/testcase/
How can I properly insert the testcase information into HTTP request body? Is the URL correct? Is the POST header correct? Which method do I have to use (POST or PUT)?
Kind regards,
Gaetano
2 answers
What's the request URI you are POSTing to?
The OSLC way of doing this is to use OSLC discovery to find an OSLC Creation Factory for test cases for the service provider for the project area of interest.For example, an OSLC service provider might define a service that includes data like this:
oslc:creationFactory [
a oslc:CreationFactory ;
oslc:creation <https://localhost:9443/qm/oslc_qm/contexts/_zw_CgZwBEe2xw5MmkuLgyg/resources/com.ibm.rqm.planning.VersionedTestCase> ;
oslc:resourceShape <https://localhost:9443/qm/oslc_qm/contexts/_zw_CgZwBEe2xw5MmkuLgyg/shape/creation/com.ibm.rqm.planning.VersionedTestCase> ;
oslc:resourceType oslc_qm:TestCase ;
dcterms:title "\n Default creation factory for TestCase\n "
] ;
That tells you the URI of the creation factory is https://localhost:9443/qm/oslc_qm/contexts/_zw_CgZwBEe2xw5MmkuLgyg/resources/com.ibm.rqm.planning.VersionedTestCase
It also references an OSLC Resource Shape that describes the OSLC properties for that creation factory.
A client can then form the RDF content they want and POST the RDF body to that creation factory.
If you're unfamiliar with OSLC, I recommend reading https://open-services.net/resources/oslc-primer/
You can find the OSLC Core specification at https://docs.oasis-open-projects.org/oslc-op/core/v3.0/os/oslc-core.html
You can find the OSLC Quality Management specification at https://docs.oasis-open-projects.org/oslc-op/qm/v2.1/os/quality-management-spec.html
You can find the ELM API Landing page at https://jazz.net/wiki/bin/view/Deployment/CLMProductAPILanding which has links to ETM specific API pages.
If you're unfamiliar with OSLC, I recommend reading https://open-services.net/resources/oslc-primer/
You can find the OSLC Core specification at https://docs.oasis-open-projects.org/oslc-op/core/v3.0/os/oslc-core.html
You can find the OSLC Quality Management specification at https://docs.oasis-open-projects.org/oslc-op/qm/v2.1/os/quality-management-spec.html
Comments
That tells you the URI of the creation factory is https://localhost:9443/qm/oslc_qm/contexts/_zw_CgZwBEe2xw5MmkuLgyg/resources/com.ibm.rqm.planning.VersionedTestCase
It also references an OSLC Resource Shape that describes the OSLC properties for that creation factory.
A client can then form the RDF content they want and POST the RDF body to that creation factory.
If you're unfamiliar with OSLC, I recommend reading https://open-services.net/resources/oslc-primer/
You can find the OSLC Core specification at https://docs.oasis-open-projects.org/oslc-op/core/v3.0/os/oslc-core.html
You can find the OSLC Quality Management specification at https://docs.oasis-open-projects.org/oslc-op/qm/v2.1/os/quality-management-spec.html Tunnel rush
You can find the ELM API Landing page at https://jazz.net/wiki/bin/view/Deployment/CLMProductAPILanding which has links to ETM specific API pages.
If you're unfamiliar with OSLC, I recommend reading https://open-services.net/resources/oslc-primer/
You can find the OSLC Core specification at https://docs.oasis-open-projects.org/oslc-op/core/v3.0/os/oslc-core.html
You can find the OSLC Quality Management specification at https://docs.oasis-open-projects.org/oslc-op/qm/v2.1/os/quality-management-spec.html Tunnel rush
It also took me a lot of time to learn all of this document.