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 :
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
David Honey (1.8k●1●7)
| answered Mar 24 '23, 1:24 p.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER What's the request URI you are POSTing to?
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.
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 David, that guy uses the Reportable REST API, not OSLC. The documentation is online on Jazz.net and can be found using the API Landing Page. In ETM the Reportable REST API is also able to create and update data.
Gaetano Rucco
commented Mar 27 '23, 3:48 a.m.
Hi David, Ralph, thanks for your answers. I'm using the Reportable REST API, as Ralph said. I read the documentation but I didn't understand how I have to build the HTTP POST body, and which URL I have to specify for my request.
I have no example for that use case. I would suggest you GET a test case first and then use the result to create a new test case. Remove data from the original to find out the minimal data needed.
Gaetano Rucco
commented Mar 27 '23, 8:45 a.m.
Ok, thanks Ralph, I'll try it. |
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.
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.
|
Your answer
Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.