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
Attribute Value : https://server-port/rm/cm/stream/_-DQnhi4kEeuEMKwTLSic6A
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
|
Accepted answer
@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
|
One other answer
Ian Barnard (2.1k●6●13)
| answered Jan 17 '23, 4:01 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
Hi
You're using the DOORS Next "Reportable REST" API. This doesn't have any way to reduce the amount of data returned.
You can get more selective data using OSLC Query https://tools.oasis-open.org/version-control/svn/oslc-core/trunk/specs/oslc-query.html
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;
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
Below is the API i am using currently
Header :
OSLC-Core-Version: 2.0
But now i am getting this response
CRRRS6254E invalid UUID Current user: https://hostserver/jts/users/XXX3CHJ. Operation: com.ibm.rrs.saveComment.
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
Rajat Krishnan
commented Feb 13 '23, 8:18 a.m.
https://rb-ubk-clm-04.de.xyz.com:9443/rm/views
&oslc_config.context=https://rb-ubk-clm-04.de.xyz.com:9443/rm/cm/stream/_iWT5Zo2LEe2vlaLwZDaerQ
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
Rajat Krishnan
commented Feb 14 '23, 5:22 a.m.
@Ian Barnard,
I tried to encode only the values but it now throws a different response message
Thank you
Ian Barnard
commented Feb 14 '23, 5:26 a.m.
| edited Feb 14 '23, 5:27 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
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
<err:detailedMessage rdf:datatype="http://www.w3.org/2001/XMLSchema#string">For input string: "http://jazz.net/ns/rm#Module"</err:detailedMessage>
<err:errorMessage rdf:datatype="http://www.w3.org/2001/XMLSchema#string">Bad Request</err:errorMessage> <err:errorStatus rdf:datatype="http://www.w3.org/2001/XMLSchema#long">400</err:errorStatus>
Ian Barnard
commented Feb 14 '23, 8:27 a.m.
| edited Feb 14 '23, 8:29 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
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
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
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.
Rajat Krishnan
commented Feb 16 '23, 1:45 a.m.
@Ian Barnard,
This works
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
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& oslc.prefix=rdm_types=<http://www.ibm.com/xmlns/rdm/types/>& oslc.prefix=dcterms=<http://purl.org/dc/terms/>& oslc.prefix=rm_nav=<http://jazz.net/ns/rm/navigation#>& oslc.where=rdm_types:ArtifactFormat=<http://jazz.net/ns/rm
com.ibm.oslc.query.parser.where.ParseException: Encountered "" at line 1, column 26.
 Was expecting one of:
 </err:detailedMessage>
Ian Barnard
commented Feb 16 '23, 6:11 a.m.
| edited Feb 16 '23, 6:13 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
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 &, < to <) 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.
Rajat Krishnan
commented Feb 17 '23, 1:26 a.m.
@Ian Barnard,
Below is my results, when i tried hitting the api in parts
Part1 :
Response : 200 OK
Part2 :
Response : 200 OK
Sorry due word limitation i will continue my comment with next immediate comment
Rajat Krishnan
commented Feb 17 '23, 1:32 a.m.
Part 3 :
Response : 400 Bad Request
<err:detailedMessage rdf:datatype="http://www.w3.org/2001/XMLSchema#string">For input string: "http://jazz.net/ns/rm#Module"</err:detailedMessage>
For all above OSLC hit, my header :
Rajat Krishnan
commented Feb 17 '23, 2:00 a.m.
Response : 400 Bad Request
<err:detailedMessage rdf:datatype="http://www.w3.org/2001/XMLSchema#string">Error when converting: oslc.query=true& oslc.prefix=rdm_types=<http://www.ibm.com/xmlns/rdm/types/>& oslc.prefix=dcterms=<http://purl.org/dc/terms/>& oslc.prefix=rm_nav=<http://jazz.net/ns/rm/navigation#>& oslc.where=rdm_types:ArtifactFormat=<http://jazz.net/ns/rm
com.ibm.oslc.query.parser.where.ParseException: Encountered "" at line 1, column 26.
 Was expecting one of:
 </err:detailedMessage>
At the end i also tried modifying things in your URI
but this too failed to get any response back from server, you can decode the above URI
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
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.