Jazz Forum Welcome to the Jazz Community Forum Connect and collaborate with IBM Engineering experts and users

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

0 votes



2 answers

Permanent link

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.

0 votes

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.

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. 

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. 

Ok, thanks Ralph, I'll try it. 


Permanent link

 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.

0 votes

Your answer

Register or log in 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.

Search context
Follow this question

By Email: 

Once you sign in you will be able to subscribe for any updates here.

By RSS:

Answers
Answers and Comments
Question details
× 10,937
× 479
× 45

Question asked: Mar 24 '23, 1:00 p.m.

Question was seen: 2,865 times

Last updated: Dec 18 '23, 4:43 a.m.

Confirmation Cancel Confirm