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

How to filter DNG RRC API

Hello Team,

I am trying to fetch Module Name and Module URI of a RM Stream using DNG RRC API, below mentioned is my api along with header

GET Request :
Header :
Name : oslc_config.context

Now whenever i am hitting this api, so i am getting alot of data along with Module Name and Module URI which result in delayed response time and hugh volume of data in response
So i just wanted to know whether we can somehow append some filter in my Request URI to get only limited data like Module name and Module URI in response?
I have already explored this wiki documentation from jazz : https://jazz.net/wiki/bin/view/Main/DNGReportableRestAPI#Configurations
But i am finding it difficult to understand the wayout, could anyone please support me here

Thank you

0 votes


Accepted answer

Permanent link
@Ian Banard,
I tried below api and it worked

Encoded :

What i was missing was "&" between oslc.prefix

Decoded URL :

But thank very much for support this really helped me to get some insights of OSLC api in DNG :)
Ralph Schoon selected this answer as the correct answer

0 votes


One other answer

Permanent link
Hi

You're using the DOORS Next "Reportable REST" API. This doesn't have any way to reduce the amount of data returned.


It's important for future compatibility to discover the Query Capability URL i.e. don't hardcode it. This article describes how to discover the OSLC Query Capability https://jazz.net/library/article/1197 and has an example of using query (although doesn't address configurations/components).

Also see this answer  for how to discover components and confiruations and the query capability when using configurations.https://jazz.net/forum/questions/266334/dduplicatesng-oslcfetch-components-from-project-area

To get only modules use;
  • oslc.where=rdm_types:ArtifactFormat=jazz_rm:Module
and the results will have URIs for all modules in the configuration you specify. To also retrieve the title use 
  • oslc.select=dcterms:title
You'll have to provide oslc.prefix to define prefixes such as those used in the above example rdm_types and jazz_rm.

It's also important to url encode all the query parameter values

An example of an encoded full query URL for modules with the title returned is:
  •  https://SERVER:PORT/rm/views?oslc.query=true&projectURL=https%3A//SERVER:PORT%3APORT/rm/process/project-areas/_h2voUFBdEe2rANSH3-kxDg&oslc.prefix=rdm_types%3D%3Chttp%3A//www.ibm.com/xmlns/rdm/types/%3E%2Cdcterms%3D%3Chttp%3A//purl.org/dc/terms/%3E%2Crm_nav%3D%3Chttp%3A//jazz.net/ns/rm/navigation%23%3E&oslc.where=rdm_types%3AArtifactFormat%3D%3Chttp%3A//jazz.net/ns/rm%23Module%3E&oslc.select=dcterms%3Aidentifier%2Crm_nav%3Aparent&oslc.paging=true&oslc.pageSize=200
HTH
Ian

1 vote

Comments
Hello,
Is it also applicable for project area with full configuration management enabled?
or we need to add this ?oslc_config.context for same
Actually i tried hitting the above api but it gives below response message
CRRRS4142E getInternalRequestHandlerService(context) returned null. This error used to report 'The requested service requires a private header'.

I have also tried with below header
DoorsRP-Request-Type : public 2.0

Not sure about your error code without full details of the GET URL, headers, etc.


When accessing the reportable REST API or the OSLC APIs for a configuration-enabled project you need to provide the configurations using either query parameter oslc_config.context or header Configuration.Context.

For OSLC APIs you must also provide header OSLC-Core-Version: 2.0



That URL isn't encoded correctly. It's ONLY the parameter values that have to be URL encoded, and you have to merge the parameters you want to use with what are already there, i.e. i.e. oslc.query=true and projectURL=... - and ONLY the first parameter is preceded by ? and the following ones are all preceded by & - NOTE This is all standard http needs, nothing to do with ELM.

Split into lines and decoded, this is:

?oslc.query=true
&projectURL=https://hostport:9443/rm/process/project-areas/_0V8dsF0rEeqOLb2pbQsvTw
&oslc.prefix=rdm_types=<http://www.ibm.com/xmlns/rdm/types/>,dcterms=<http://purl.org/dc/terms/>,rm_nav=<http://jazz.net/ns/rm/navigation#>
&oslc.where=rdm_types:ArtifactFormat=<http://jazz.net/ns/rm#Module>
&oslc.select=dcterms:identifier,rm_nav:parent
&oslc.paging=true
&oslc.pageSize=200
&oslc_config.context=https://hostport:9443/rm/cm/stream/_iWT5Zo2LEe2vlaLwZDaerQ




https://rb-ubk-clm-04.de.xyz.com:9443/rm/views
?oslc.query=true
&projectURL=https://rb-ubk-clm-04.de.xyz.com:9443/rm/process/project-areas/_0V8dsF0rEeqOLb2pbQsvTw
&oslc.prefix=rdm_types%3D%3Chttp%3A%2F%2Fwww.ibm.com%2Fxmlns%2Frdm%2Ftypes%2F%3E%2Cdcterms%3D%3Chttp%3A%2F%2Fpurl.org%2Fdc%2Fterms%2F%3E%2Crm_nav%3D%3Chttp%3A%2F%2Fjazz.net%2Fns%2Frm%2Fnavigation%23%3E
&oslc.where=rdm_types%3AArtifactFormat%3D%3Chttp%3A%2F%2Fjazz.net%2Fns%2Frm%23Module%3E
&oslc.select=dcterms%3Aidentifier%2Crm_nav%3Aparent
&oslc.paging=true
&oslc.pageSize=200


Header :
Accept : application/rdf+xml
OSLC-Core-Version: 2.0

Response message : java.lang.IllegalArgumentException: The given URI [https://rbubkclm04dexyzcom:9443/rm/views20][views%20] was not a recognised Fronting URI or Storage URI

@Ian Barnard,
I tried to encode only the values but it now throws a different response message
Thank you

Are you concatenating all the parameters onto the basic URL, i.e. with no line-breaks or space characters? I just used that way of splitting onto lines to make it easier to see the parameters; when you POST it needs to be one long string

@Ian Barnard,
yes i passed it as one complete url (no space no linebreak in between)
sorry i forgot to mention the error message now it shows this

There's something wrong with what you're doing. The example I gave in my answer worked, with the headers you are using. It's easiest to get this working with a REST client in your browser before coding it. Start by simply using the unadorned query string plus only the oslc_config.context parameter

This should return the (first page of) all the artifacts in the specified configuration. If it doesn't then there's something very basic going wrong. Once that works, add on the oslc.select and check the results include these values, then add the oslc.where, and so on.

@Ian Barnard,
This works
but whenever i try to add anything it always throws

 <err:detailedMessage rdf:datatype="http://www.w3.org/2001/XMLSchema#string">Error when converting: oslc.query=true&amp; oslc.prefix=rdm_types=&lt;http://www.ibm.com/xmlns/rdm/types/&gt;&amp; oslc.prefix=dcterms=&lt;http://purl.org/dc/terms/&gt;&amp; oslc.prefix=rm_nav=&lt;http://jazz.net/ns/rm/navigation#&gt;&amp; oslc.where=rdm_types:ArtifactFormat=&lt;http://jazz.net/ns/rm
      com.ibm.oslc.query.parser.where.ParseException: Encountered "" at line 1, column 26.&#xD; Was expecting one of:&#xD;
   </err:detailedMessage>

From the little infomation you provided it looks like

a) you're still not url encoding the parameter values correctly.- the value is the bit after the parameter name=, e.g. &oslc.prefix=... for example if you want to specify oslc.prefix=dcterms=<http://purl.org/dc/terms/> the value MUST be url encoded - so should appear in the URL as e.g. oslc.prefix=dcterms%3D%3Chttp%3A%2F%2Fpurl.org%2Fdc%2Fterms%2F%3E
Notice how the = in the parameter value isn't visible when url encoded. Also note that XML/HTML escape encoding (e.g. & to &amp;, < to &lt;) is NOT the same as url encoding.

and b) it looks like there are spaces in the url - that WILL make the request FAIL

Also, add one parameter to the URL at a time and check it works before adding the next, because that way you'll get more of a pointer of where you're going wrong.

If it still doesn't work after you';ve fixed these issues paste the entire URL literally as used to make the request in here.

Hi Rajat  I can't see anything wrong with your query#3 that doesn't work, so I can't explain this, but that style of query works for me.

showing 5 of 18 show 13 more comments

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,940

Question asked: Jan 16 '23, 5:55 a.m.

Question was seen: 1,477 times

Last updated: Feb 21 '23, 7:24 a.m.

Confirmation Cancel Confirm