It's all about the answers!

Ask a question

How to create RM Artifact in REST API


Steven Wallace (337) | asked Jul 21 '20, 9:47 a.m.

I've been successful in creating both test scripts and test cases, but I can't figure out how to create a RM Artifact. I'd like to do similar to what I did with the test script/cases. For example: I queried for an existing test case using a GET to "/service/com.ibm.rqm.integration.service.IIntegrationService/resources/<project>/testcase/urn:com.ibm.rqm:testcase:<id>". I then edited the response xml to contain data for the new test case I'd like to create and performed a POST with it. Is is possible to do something similar with a an Artifact. To be specific I'm attempting to make the type="Test Point" with a format="Text". I'm pretty sure what I'm missing is the url, probably something like "/service/com.ibm.rqm....".

One answer



permanent link
My-An Nguyen (2963) | answered Jul 21 '20, 10:51 a.m.
edited Jul 21 '20, 10:51 a.m.
You can create artifacts in RM using the OSLC API:

Comments
Steven Wallace commented Jul 21 '20, 2:59 p.m.
Thanks for the link. While trying what is proposed I get the following error.

Command: "/rm/discovery/<project>services.xml"
Response: 400 - CRJAZ1675E The query cannot be completed because it is missing this service type or applicaiton ID parameters.

Steven Wallace commented Jul 21 '20, 3:21 p.m.

Looks like I need to use something like the rauth module in python instead of the requests module. Can anyone confirm? Is the only way to interact with artifacts is via OAuth? I was able to read/create/update test case/scripts without this additional step.


Ian Barnard commented Jul 22 '20, 12:54 p.m. | edited Jul 22 '20, 1:14 p.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

Requests definitely works with Jazz, although I've only used it for form authorisation and as they say other types of authorisation are available, e.g. oidc when using Jazz Authorisation Server, but that just ends up as a slighly different sort of form auth.


That URL looks wrong, looks like you're trying to construct it? But you shouldn't be constructing it - you should discover it through /rm/rootservices, which has a catalog descriptor like <oslc_rm:rmServiceProviders rdf:resource="https://server:port/rm/cat"/> - use that URL (my example isn't the actual type of URL you get) to get the projects as another stream of RDF, find the one you want by its dcterms:title.

The project catalog is a protected resource so you will get some flavour of rejection which can be an apparent success 200 BUT if this has a header X-com-ibm-team-repository-web-auth-msg: authrequired then you've got to do login - see under the heading FORM Challenge hereĀ https://jazz.net/wiki/bin/view/Main/NativeClientAuthentication


Ian Barnard commented Jul 22 '20, 1:16 p.m. | edited Jul 22 '20, 1:16 p.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

In fact the best tactic for login is not to do an explicit login but for each request check for an authrequired header in the response and do the login, then replay the original request. This then automatically logs you in when your authentication expires in 2/6/whatever hours.

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.