How get link types from RDNG
Hello!
I need to get information about available link types in a project area. Using next link:
I can find that next REST API request is legal:
But server response to this link is:
Error 400: Bad Request
If I try use something like next:
Then returned empty XML document:
So the question is, how can be loaded information about available link types for a project area with either REST or OSLC API?
Thank you!
|
2 answers
<style type="text/css">
p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px 'Helvetica Neue'} p.p2 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px 'Helvetica Neue'; min-height: 14.0px} p.p3 {margin: 0.0px 0.0px 2.0px 0.0px; font: 14.0px 'Helvetica Neue'} span.s1 {color: #dca10d} span.s2 {text-decoration: underline ; color: #dca10d}
</style>
Hi Dmitry
As mentioned in Reportable API Wiki https://jazz.net/wiki/bin/view/Main/DNGReportableRestAPI, REST API request https://serverName:Port/rm/publish/linktypes is used by ETL, that means that it will provide link types only for "opt out" (configuration management disabled) project areas.
If there is no "opt out" project areas in the server, then it is expected an empty XML document, same is expected when using parameter "projectURI" and the project area provided has configuration management enabled.
Unfortunately I don't know any other way to get project link types. Comments
Dmitry A. Lesin
commented Aug 21 '19, 12:20 p.m.
Hi Ivan,
Thank you for the information. I appreciate it so much.
You are right at all. My project area is under configuration management. and we need to create links in a change set. This is a customer's prerequisite for an extension being developed.
It seems that I found some another way how to get this data. I have found that in OSLC project area services (services.xml), in " <oslc:creationFactory>" group, there's some record like next:
This URI being GET returns a response that contains all descriptions of link types. But the problem is that there's a lot of such records there. And now the problem is how define a correct record with link types in advance. I think it's not a good way to request all similar records and try to define the correct one.
Don't you know how we can do it? I believe that it can solve the current problem, at least in a theory.
Thank you!
|
In a CM enabled environment I was able to do the following:
GET the services.xml file using this URL:
https://<hostname>:<port>/rm/oslc_rm/<PROJECT_AREA_UUID>/services.xml?oslc_config.context=https://<hostname>:<port>/rm/cm/stream/<STREAM_UUID>
Headers:
Accept = application/rdf+xml OSLC-Core-Version = 2.0
In the response from the GET request was the URLs for the types.
I then took this URL and did the following GET:
Headers:
Accept = application/rdf+xml OSLC-Core-Version = 2.0 URL: https://<hostname>:<port>/rm/types/OT_xvyTcYuLEe2Bk9tMZMvU5Q?oslc_config.context=https://<hostname>:<port>/rm/cm/stream/<STREAM_UUID> Comments Clients should never hard code or make assumptions about URI patterns. If you want to know the URI of an OSLC service provider, use OSLC discovery.
Ian Barnard
commented Mar 16 '23, 7:39 a.m.
| edited Mar 16 '23, 7:48 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
In each shape the link types can be identified as the tags that contain a tag:
<oslc:valueType rdf:resource="http://open-services.net/ns/core#Resource"/>
At least for DN all the link types appear to be repeated in all the shapes, so it's possible that just retrieving the first shape will get you all the link types. Not sure about this. Anyway these only change when a new link type is created, so maybe you could use e.g. http caching so re-retrieving doesn't require a GET to the server, or your app saves them and only refresh when user chooses or (perhaps) 7 days since last retrieved.
Before anyone asks about link constraints, AFAIK these aren't exposed in any public API https://jazz.net/wiki/bin/view/Deployment/CLMProductAPILanding
GCM has similar tags in properties its shapes to denote link types - although it also has the benefit of a (OSLC) QueryCapability for link types :-)
Ian Barnard
commented Mar 16 '23, 9:38 a.m.
| edited Mar 16 '23, 9:40 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
I agree with David about it being not a good approach to hardcode URL patterns, instead to use discovery. In this case for DN the link types can be discovered from the shapes, all accessible using OSLC-Core-Version: 2.0 and with no indication that this is a private API. |
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.