Create a testcase using REST API
- ContentTypeHeader: application/xml (or application/json)
- Accept: application/xml (or application/json)
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 " ] ;
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.
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.
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
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