It's all about the answers!

Ask a question

Create a testcase using REST API


Gaetano Rucco (112) | asked Mar 24 '23, 1:00 p.m.
edited Mar 24 '23, 1:01 p.m.
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



permanent link
David Honey (1.8k17) | answered Mar 24 '23, 1:24 p.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

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                        "
     ] ;
    
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.


Comments
Ralph Schoon commented Mar 25 '23, 3:33 p.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

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.
Could you give me an example (or a link in which I can find the steps) to build the request ?
Thanks. 


Ralph Schoon commented Mar 27 '23, 4:30 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

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. 


permanent link
Lukas Ziemann (11) | answered Dec 18 '23, 4:43 a.m.

 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.
It also took me a lot of time to learn all of this document.

Your answer


Register or to post 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.