It's all about the answers!

Ask a question

REST API for the Rational Requirements Composer


Rangachari Anand (1) | asked Jun 23 '11, 10:33 a.m.
We would like to be able to access artifacts stored in a requirements oroject in RRC 3.0.1. Although there apparently is no published REST API, I thought that I would try the same approach that is described for RTC:

I started with:
https://<hostname>:9443/rm/rootservices

and tried to navigate to the service descriptor for a reqiuirements project. However, I found that unlike the ccm case, very little information is actually available through this API for requirements projects.

In contrast, I notice that an SDK was available for release 2: https://jazz.net/wiki/bin/view/Main/RationalRequirementsComposer2SampleCode

Will this get updated for 3.0.1 ?

Thanks

21 answers



permanent link
Florian Georg (19031918) | answered Oct 14 '11, 10:07 a.m.
Just to make sure, as I wrote earlier - did you add the HTTP header
OSLC-Core-Version="2.0" 

to your GET request for the service provider?

If you just use your browser to load the services.xml, you will probably get the OSLC RM v1.0 version of it (with limited services).
This is because of backward compatibility, as described here in the spec:
http://open-services.net/bin/view/Main/OslcCoreSpecification?sortcol=table;up=#Specification_Versioning

Try using a REST client, like Poster or REST client (FireFox addons) in order to set the HTTP header properly...

hope that helps
Florian

permanent link
Sean Griffin (2166) | answered Oct 14 '11, 11:46 a.m.
Thanks so much Florian.

Yes, that got me over that hurdle, and I can now access the query service for example.

Though has anyone noticed that the query service doesn't return all the properties of a requirement? Maybe I'm missing something again, but I'm not able to get even title or name of the requirement from a query? I'm thinking that I'll need to perform a HTTP GET of every individual requirement URL in RRC. This could potentially be hundreds of requirements.

For example, I have 3 requirements defined in RRC.

Here's the URL syntax I'm calling:

https://localhost:9443/rm/views?oslc.select=*

and what I get back is as follows (you'll notice there's nothing in these results that give the name of the requirement):

<rdf:Description rdf:about="http://example.com/query">
<rdfs:member>
<oslc_rm:Requirement rdf:about="https://localhost:9443/rm/resources/_63wuq924EeC5dZI2YAS1KA">
<dcterms:created rdf:datatype="http://www.w3.org/2001/XMLSchema#dateTime">2011-09-13T03:31:51.578Z</dcterms:created>
<dcterms:creator rdf:resource="https://localhost:9443/jts/users/seangriffin"/>
<dcterms:modified rdf:datatype="http://www.w3.org/2001/XMLSchema#dateTime">2011-09-13T03:31:51.578Z</dcterms:modified>
<dcterms:contributor rdf:resource="https://localhost:9443/jts/users/seangriffin"/>
<rmTypes:ArtifactFormat rdf:resource="https://localhost:9443/rm/types/_y8-Cc924EeC5dZI2YAS1KA#Text"/>
</oslc_rm:Requirement>
</rdfs:member>
<rdfs:member>
<oslc_rm:Requirement rdf:about="https://localhost:9443/rm/resources/_BkI24O9bEeCJoPl09-jWdQ">
<dcterms:created rdf:datatype="http://www.w3.org/2001/XMLSchema#dateTime">2011-10-05T14:05:04.796Z</dcterms:created>
<dcterms:creator rdf:resource="https://localhost:9443/jts/users/seangriffin"/>
<oslc_rm:validatedBy rdf:resource="https://localhost:9443/qm/oslc_qm/contexts/_pwiisN0uEeCS1eKs2iieeQ/resources/com.ibm.rqm.planning.VersionedTestCase/_7DzWYe9aEeCImLNIO7VAKg"/>
<dcterms:modified rdf:datatype="http://www.w3.org/2001/XMLSchema#dateTime">2011-10-05T14:05:24.796Z</dcterms:modified>
<dcterms:contributor rdf:resource="https://localhost:9443/jts/users/seangriffin"/>
<rmTypes:ArtifactFormat rdf:resource="https://localhost:9443/rm/types/_y8-Cc924EeC5dZI2YAS1KA#Text"/>
</oslc_rm:Requirement>
</rdfs:member>
<rdfs:member>
<oslc_rm:Requirement rdf:about="https://localhost:9443/rm/resources/_TRhepu9bEeCJoPl09-jWdQ">
<dcterms:created rdf:datatype="http://www.w3.org/2001/XMLSchema#dateTime">2011-10-05T14:07:03.687Z</dcterms:created>
<dcterms:creator rdf:resource="https://localhost:9443/jts/users/seangriffin"/>
<oslc_rm:validatedBy rdf:resource="https://localhost:9443/qm/oslc_qm/contexts/_pwiisN0uEeCS1eKs2iieeQ/resources/com.ibm.rqm.planning.VersionedTestCase/_rpT-AN01EeCMz6XZWQ9SNg"/>
<dcterms:modified rdf:datatype="http://www.w3.org/2001/XMLSchema#dateTime">2011-10-14T11:40:03.536Z</dcterms:modified>
<dcterms:contributor rdf:resource="https://localhost:9443/jts/users/seangriffin"/>
<rmTypes:ArtifactFormat rdf:resource="https://localhost:9443/rm/types/_y8-Cc924EeC5dZI2YAS1KA#Text"/>
</oslc_rm:Requirement>
</rdfs:member>
</rdf:Description>

permanent link
Rosa Naranjo (2.9k11723) | answered Oct 14 '11, 12:55 p.m.
FORUM MODERATOR / JAZZ DEVELOPER
seangriffin

let me assure you that OSLC RM API works with RRC 3.0.1. I just completed the finishing touches on the update to the OSLC workshop which will include OSLC-RM API examples. For some of the basics like the QueryBase capability, it actually works very much the same as it does with the examples we already have in the current download for OSLC-CM. I hope you have downloaded the existing workshop materials and setup your environment to use the REST Client add-on for Firefox.

Let me take you through some simple examples. Hopefully, it will clear things up. I have a RRC 3.0.1 server up and running and I have created a Lifecycle project using the Money that Matters sample. This gives me a JKE Banking (Requirements) project. When I use the proper OSLC V2 header and do a GET on the services resource document for this project, I get the following services:

2 oslc:selectionDialog, one for Requirement and one for Collection
2 oslc:creationDialog, one for Requirement and one for Collection
1 oslc:creationFactory with dcterms:title Requirement Creation Factory
1 oslc:creationFactory with dcterms:title Collection Creation Factory
1 oslc:queryCapability service

from the above oslc:queryCapability, look for the oslc:queryBase URI. It should look something like this: https://jazz.server.com:9443/rm/views?oslc.query=true&projectURL=https%3A%2F%2Fjazz.server.com%3A9443%2Fjts%2Fprocess%2Fproject-areas%2F_4QtrwLE1EeC--cDfe44EPg

If you do a GET on this URI, you will get a listing of all the requirements and collections in this project. Of course, you most likely want to filter on fulltext using the oslc:searchterms property or use the SQL like oslc:where property.

Here is an example where I am performing a query by ID and I want to show all details on the query result. Just append the following to your queryBase URI: &oslc.prefix=dcterms=<http://purl.org/dc/terms/>&oslc.where=dcterms:identifier=32&oslc.select=*
This defines the namespace for dcterms so I can use dcterms:identifier in the oslc.where clause. oslc.select=* means I want to see all properties of requirement with ID=32.

In my sample project, I get something like this as a result:

<rdf:RDF xmlns:oslc="http://open-services.net/ns/core#"
xmlns:oslc_rm="http://open-services.net/ns/rm#"
xmlns:dcterms="http://purl.org/dc/terms/"
xmlns:rmTypes="http://www.ibm.com/xmlns/rdm/types/"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
xmlns:rt="https://jazz.server.com:9443/rm/types/"
>
<oslc:ResponseInfo rdf:about="https://jazz.server.com:9443/rm/views?oslc.query=true&oslc.prefix=dcterms=%3Chttp://purl.org/dc/terms/%3E&oslc.where=dcterms:identifier=32&oslc.select=*">
<dcterms:title>Query Results: 1</dcterms:title>
</oslc:ResponseInfo>
<rdf:Description rdf:about="http://example.com/query">
<rdfs:member>
<oslc_rm:Requirement rdf:about="https://magellan3.bocaraton.ibm.com:9443/rm/resources/_I5GaWrE2EeC--cDfe44EPg">
<oslc_rm:validatedBy rdf:resource="https://jazz.server.com:9443/qm/oslc_qm/contexts/_8wKSkrE1EeCga40hUKmZ5w/resources/com.ibm.rqm.planning.VersionedTestCase/_oKeyxbE2EeCga40hUKmZ5w"/>
<rt:_F3it2rE2EeC--cDfe44EPg rdf:resource="https://jazz.server.com:9443/rm/types/_FynxmrE2EeC--cDfe44EPg#dd84ed1c-9786-469b-85a2-517388d6a09b"/>
<dcterms:contributor rdf:resource="https://jazz.server.com:9443/jts/users/clmadmin"/>
<rmTypes:ArtifactFormat rdf:resource="https://jazz.server.com:9443/rm/types/_42He-LE1EeC--cDfe44EPg#Text"/>
<rt:_41hCALE1EeC--cDfe44EPg rdf:datatype="http://www.w3.org/2001/XMLSchema#dateTime">2011-07-18T12:05:06.921Z</rt:_41hCALE1EeC--cDfe44EPg>
<rt:_F2WbCrE2EeC--cDfe44EPg rdf:resource="https://jazz.server.com:9443/rm/types/_FwiG6rE2EeC--cDfe44EPg#99f14384-948b-4c7c-8c63-59d56cfe92a1"/>
<dcterms:identifier rdf:datatype="http://www.w3.org/2001/XMLSchema#integer">32</dcterms:identifier>
<rt:_40egJrE1EeC--cDfe44EPg rdf:resource="https://magellan3.bocaraton.ibm.com:9443/jts/users/clmadmin"/>
<dcterms:created rdf:datatype="http://www.w3.org/2001/XMLSchema#dateTime">2011-07-18T12:04:50.421Z</dcterms:created>
<dcterms:creator rdf:resource="https://jazz.server.com:9443/jts/users/clmadmin"/>
<dcterms:modified rdf:datatype="http://www.w3.org/2001/XMLSchema#dateTime">2011-07-18T12:05:06.921Z</dcterms:modified>
<rt:_F4IjurE2EeC--cDfe44EPg rdf:resource="https://jazz.server.ibm.com:9443/rm/types/_FxIj4bE2EeC--cDfe44EPg#3816089d-8455-4d2d-8926-a03ad89a6191"/>
<rt:_40oRMrE1EeC--cDfe44EPg rdf:datatype="http://www.w3.org/2001/XMLSchema#dateTime">2011-07-18T12:04:50.421Z</rt:_40oRMrE1EeC--cDfe44EPg>
<rt:_F3PL2rE2EeC--cDfe44EPg rdf:resource="https://jazz.server.com:9443/rm/types/_Fx4KurE2EeC--cDfe44EPg#8fb41825-9399-4e68-8977-290dad5f8cb9"/>
<dcterms:title>Organization must identify how much money is desired</dcterms:title>
<rmTypes:PrimaryText></rmTypes:PrimaryText>
<dcterms:description></dcterms:description>
<rt:_F5LFk7E2EeC--cDfe44EPg rdf:resource="https://jazz.server.ibm.com:9443/rm/types/_FwiG6rE2EeC--cDfe44EPg#4629eb0b-487a-4d25-80aa-845e5c48a493"/>
<rt:_40xbJ7E1EeC--cDfe44EPg rdf:resource="https://jazz.server..com:9443/jts/users/clmadmin"/>
<oslc_rm:implementedBy rdf:resource="https://jazz.server.com:9443/ccm/resource/itemName/com.ibm.team.workitem.WorkItem/60"/>
</oslc_rm:Requirement>
</rdfs:member>
</rdf:Description>
</rdf:RDF>


I hope this helps. There will be more examples using the REST Client add-on for Firefox and programmatic samples in the OSLC workshop article #635 update which will be posted soon.

permanent link
Rosa Naranjo (2.9k11723) | answered Oct 14 '11, 12:57 p.m.
FORUM MODERATOR / JAZZ DEVELOPER
Freddy

I am able to use these types in the JKE Banking sample so please contact me offline so I can understand better what you mean by 'I can't seem to use the OSLC link types'.

Thanks Rosa.
So none of the "inter-requirement" links from the OOTB templates (eg. Child of, Embeds, Link To, Illustrated By, Satisfied By, Constrained by) are exposed :-( And I can't seem to use the "OSLC Affected By, OSLC Elaborated By and OSLC Specified by" link types, at least in the JKE Banking or the Use Case template.

Freddy

permanent link
Sean Griffin (2166) | answered Oct 14 '11, 9:14 p.m.
Thanks Rosa. That was indeed helpful.

I followed your example and was able to extract a single requirement, as you had. Will look forward to that updated workshop.

My question however is why my query doesn't extract as much data as yours. For example, you were able to extract the <dcterms:title> tag, yet mine doesn't have that, and I'm unable to therefore get the name of the requirement from this query (which of course is one of the most important parts of a requirement).

Here's the result I get from executing the same GET:

<rdf:RDF xmlns:oslc="http://open-services.net/ns/core#"
xmlns:oslc_rm="http://open-services.net/ns/rm#"
xmlns:dcterms="http://purl.org/dc/terms/"
xmlns:rmTypes="http://www.ibm.com/xmlns/rdm/types/"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
>
<oslc:ResponseInfo rdf:about="https://localhost:9443/rm/views?oslc.query=true&oslc.prefix=dcterms=%3Chttp://purl.org/dc/terms/%3E&oslc.where=dcterms:identifier=2&oslc.select=*">
<dcterms:title>Query Results: 1</dcterms:title>
</oslc:ResponseInfo>
<rdf:Description rdf:about="http://example.com/query">
<rdfs:member>
<oslc_rm:Requirement rdf:about="https://localhost:9443/rm/resources/_BkI24O9bEeCJoPl09-jWdQ">
<dcterms:created rdf:datatype="http://www.w3.org/2001/XMLSchema#dateTime">2011-10-05T14:05:04.796Z</dcterms:created>
<dcterms:creator rdf:resource="https://localhost:9443/jts/users/seangriffin"/>
<oslc_rm:validatedBy rdf:resource="https://localhost:9443/qm/oslc_qm/contexts/_pwiisN0uEeCS1eKs2iieeQ/resources/com.ibm.rqm.planning.VersionedTestCase/_7DzWYe9aEeCImLNIO7VAKg"/>
<dcterms:modified rdf:datatype="http://www.w3.org/2001/XMLSchema#dateTime">2011-10-05T14:05:24.796Z</dcterms:modified>
<dcterms:contributor rdf:resource="https://localhost:9443/jts/users/seangriffin"/>
<rmTypes:ArtifactFormat rdf:resource="https://localhost:9443/rm/types/_y8-Cc924EeC5dZI2YAS1KA#Text"/>
</oslc_rm:Requirement>
</rdfs:member>
</rdf:Description>
</rdf:RDF>

permanent link
Sean Griffin (2166) | answered Oct 14 '11, 9:41 p.m.
Also having troubles with a HTTP POST to generate a new requirement.

I've located the requirement creation factory as:

https://localhost:9443/rm/requirementFactory?projectURL=https%3A%2F%2Flocalhost%3A9443%2Fjts%2Fprocess%2Fproject-areas%2F_xp0_cN24EeC5dZI2YAS1KA

when I perform a POST to this service, with XML as follows, then RRC does indeed generate a requirement, because I can see the new requirement in the "View All Artifacts" page of RRC. However when I click on the requirement to open it in full view, what I get is the requirement page with no content displayed at all, and the text "Generating content, please wait...". The page never updates. On the right side of the page is the typical panel with "Overview", "Comments", "Links" and "Collections and Reviews".

Here is the XML I am POSTing:

<?xml version="1.0" encoding="UTF-8"?><rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:calm="http://jazz.net/xmlns/prod/jazz/calm/1.0/" xmlns:dc="http://purl.org/dc/terms/" xmlns:oslc="http://open-services.net/ns/core#" xmlns:oslc_rm="http://open-services.net/ns/rm#" xmlns:public_rm_10="http://www.ibm.com/xmlns/rm/public/1.0/" xmlns:rm="http://www.ibm.com/xmlns/rdm/rdf/" xmlns:rm_property="https://localhost:9443/rm/types/">

<oslc_rm:Requirement rdf:about="https://localhost:9443/rm/resources/_63wuq924EeC5dZI2YAS1KA">

<rm_property:_0d1YKt24EeC5dZI2YAS1KA rdf:resource="https://localhost:9443/rm/types/_0VyPat24EeC5dZI2YAS1KA#b83f7b68-e1dc-445a-811d-e3cd6d5449fd"/>

<dc:description rdf:parseType="Literal">req1 new2 desc</dc:description>

<rm_property:_y6vNzd24EeC5dZI2YAS1KA rdf:resource="https://localhost:9443/rm/types/_y8-Cc924EeC5dZI2YAS1KA#Text"/>

<oslc:instanceShape rdf:resource="https://localhost:9443/rm/types/_0gXHut24EeC5dZI2YAS1KA"/>

<rdf:type rdf:resource="http://open-services.net/ns/rm#Requirement"/>

<oslc:serviceProvider rdf:resource="https://localhost:9443/rm/discovery/_xp0_cN24EeC5dZI2YAS1KA/services.xml"/>

<dc:title rdf:parseType="Literal">req1 new3</dc:title>

</oslc_rm:Requirement>
</rdf:RDF>

permanent link
Djalma Passos (6) | answered Nov 25 '11, 5:15 p.m.
I need to retrieve the list of attributes created in a project. For accurate identifier of the attribute to a search where the attribute has a certain value.

ex:
<rt>true</rt>

I tried a url
https://jazz.myServer:9443/rm/types/

but this standard had the following result

<rdf>
<rdf>
<err>java.lang.NullPointerException (More info found at entry in RRS server log)</err>
<err>Internal Error</err>
<err>500</err>
</rdf>
</rdf>


can anyone help me?

permanent link
Rosa Naranjo (2.9k11723) | answered Nov 28 '11, 12:03 p.m.
FORUM MODERATOR / JAZZ DEVELOPER
Hello
Try the example in the recently published update to the OSLC workshop that deals with using the creation factory for requirements.

For both this post and the one before, perhaps what is needed is a defect workitem filed with logs attached for debugging by development.

On the earlier post, can you try the get on a requirement from the MTM sample project? If it works with the MTM sample data, then it can be an issue with the type of project you are using with this OSLC call.

Also having troubles with a HTTP POST to generate a new requirement.

I've located the requirement creation factory as:

https://localhost:9443/rm/requirementFactory?projectURL=https%3A%2F%2Flocalhost%3A9443%2Fjts%2Fprocess%2Fproject-areas%2F_xp0_cN24EeC5dZI2YAS1KA

when I perform a POST to this service, with XML as follows, then RRC does indeed generate a requirement, because I can see the new requirement in the "View All Artifacts" page of RRC. However when I click on the requirement to open it in full view, what I get is the requirement page with no content displayed at all, and the text "Generating content, please wait...". The page never updates. On the right side of the page is the typical panel with "Overview", "Comments", "Links" and "Collections and Reviews".

Here is the XML I am POSTing:

<xml><rdf>

<oslc_rm>

<rm_property>

<dc>req1 new2 desc</dc>

<rm_property>

<oslc>

<rdf>

<oslc>

<dc>req1 new3</dc>

</oslc_rm>
</rdf>

permanent link
Daniel Bryon (6) | answered Dec 01 '11, 10:09 a.m.
First sorry for the long post.
I trying to be clear about it

I have two problems:

We created a custom Attribute and named it IM which is a boolean attribute. We saw that the name for the attribute was generated or encrypted, is there a way to identify this attribute without needing to actually see the generated ID?
This is how it was displayed for us:
<rt>false</rt>
We need to use it on the where clause or our select, is it possible? How can we identify it?
Example:
"&oslc.where="+ URLEncoder.encode("rt:IM=false", "UTF8");

Second:
We managed to query the requirements from RRC just fine but we are having some troubles trying to query using the dcterms:modified attribute, which is a Date field.
We followed an example on the OSLC documentation and it did not work. The query show no results.
This is the example from the website:
?oslc.where=dcterms:title="test case 1" and dcterms:modified>="2008-12-02T18:42:30"
We even tried a different example also from OSLC documentation which doesn't use the time only the date ("2011-11-10") and it also did not work.
It doesn't show us any error but my guess is that the date format is wrong somehow. When we use a different filed like dcterms:identifier or dcterms:title it works just fine.

We are using the sample code from the workshop, this is how we are doing it:
String oslcSearchByModifiedQuery = queryCapabilityURI
+ "&oslc.prefix="
+ URLEncoder.encode("dc=<http>","UTF8")+
"&oslc.select=" + URLEncoder.encode("dc:title", "UTF8") +
"," + URLEncoder.encode("dc:description", "UTF8") +
"," + URLEncoder.encode("dc:modified", "UTF8") +
"," + URLEncoder.encode("dc:identifier", "UTF8") +
"&oslc.where="+ URLEncoder.encode("dc:modified>\"2011-11-27\"", "UTF8");

Thanks,
Daniel Bryon

permanent link
Atul Kundu (611) | answered Dec 08 '11, 2:03 a.m.
In our local system we have installed RRC 3.0.
Using the ReST api (CCM) we are able to get & post data as required.
But while we are trying the same using ReST api (rm) we are facing problem.
Using https://localhost:9443/rm/publish/resources/* we are able to get posted requirements in the system. Our aim to post some requirement using ReST api of requirement management service. As found in the forum while we are trying to post requirement using the ReST api (https://localhost:9443/rm/requirementFactory) it is throwing the error ID CRRRW7552E The item that you are trying to view cannot be found in the database. It might have been deleted by another user.

While using https://localhost:9443/rm/requirementFactory?projectURL=https://localhost:9443/jts/process/project-areas/_PP9xIBXQEeGGkZdRRllplA
to post data using the following xml

<xml>
<rdf>

<oslc_rm>
<rm_property>
<dc>req1 new2 desc</dc>
<rm_property>
<oslc>
<rdf>
<oslc>
<dc>req1 new3</dc>
</oslc_rm>
</rdf>

the error is being displayed as follows:
Error 403: Forbidden

CRRRS8656E Could not retrieve object type https://localhost:9443/rm/types/_PP9xIBXQEeGGkZdRRllplA; Exception: class com.ibm.rdm.fronting.server.exception.UnexpectedResponseException: HTTP/1.1 404 CRRRS8661E The server encountered an error while checking System Attributes: HTTP/1.1 404 CRRRS8661E The server encountered an error while checking System Attributes: HTTP/1.1 404 (More info found at entry in RRS server log)

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.