It's all about the answers!

Ask a question

Doors next generation 7.0.3: Pull all attribute values for an artifact


Joshua Baxter (166) | asked Oct 14, 4:53 p.m.

I discovered this API for pulling data for an artifact: https://jazz.net/wiki/bin/view/Main/DNGReportableRestAPI . I tested it and it doesn't appear that it returns all the attribute values (values for all the columns) for the artifact. For example, the artifact has a "Contents" column which displays the text content for the artifact that represents the requirement's details. However, the value for this column was not  returned by the API as it was not in the <rrm:attributesXML element returned by the API, only the value for the ID was in the <rrm:attributesXML element. How do I retrieve all the attribute values for an artifact using the API?

2 answers



permanent link
Davyd Norris (2.6k217) | answered Oct 15, 1:12 a.m.
You'll need to give us more information here.

What was the actual call you used to retrieve the information? The Reportable REST API has a number of end points that give various subsets of detail so it's important to use the correct one. 

You can retrieve the schema for each end point by using the ?metadata=schema parameter at the end of the endpoint, and this will give you the layout of the returned results.

The end point resources is the most generic and will get you high level lists of artefacts. The text endpoint is the one you want if you know the individual artefact URI or ID - this will pull all the details of an artefact including all attributes and the Primary test, both rich text formatted and plain text.

Comments
Joshua Baxter commented Oct 15, 8:12 p.m.

Sorry I forgot to specify the end point I was calling. I was calling the resources end point. I'll try calling the text endpoint, thanks. Also, for parameters such as resourceURI and moduleURI which are used in many of the API calls at https://jazz.net/wiki/bin/view/Main/DNGReportableRestAPI, what is the maximum amount of URIs that can be passed into those parameters? Asking because want to know what the limit is before have to make a separate API call.


Davyd Norris commented Oct 15, 8:44 p.m.
As far as I know there's no limit, but for the text endpoint you'll either use the resourceURI or the artefact ID. 

ModuleURI only applies to artefacts that are module format, and for those you'll need to get them via the resource or modules endpoints.

For very large data sets, the returned results will be paged, with a default page size of 100 artefacts. You can change this number as part of your call but there's a hard limit set on the server so anything larger will be ignored. If you examine the returned results it'll tell you if there are more and give you details on the URL to call to get the next page

Joshua Baxter commented 2 days ago

Thanks for your responses. I have a few more questions.

  1. How do I programmatically get resourceURIs and moduleURIs given that I have the artifact ID? Right now I only know how to get these manually.
  2. How do I programmatically get the desired configuration URL for the oslc_config.context parameter given I know the global configuration stream name?
  3. Are there any examples of how to programmatically call API's? For example, values needed for header, any sort of values/cookies/tokens needed to provide to the API for authentication, etc? Right now I've just been calling these APIs manually by copying the URL into the browser.


Davyd Norris commented 2 days ago
This is a huge discussion! First the simple ones.

1. You can just use the artefact ID in filters - much simpler. Have a look at the API end point examples in the wiki and you can see how they are used. For things like modules, they return a list of artefacts in them and some basic info from the artefact. Each entry also has an about field which contains the resource URI, so you can use that to create a  call to the text endpoint.

2. If you're not using GCM or Local CM, you can leave off the context for many of the calls. IF you are then that's a new discussion.

3. There are a number of blogs, entries in the wiki, workshops, examples, etc. around how to be a well behaved Jazz/ELM client. Ralph's blogs are great, as is the Deployment wiki:


Joshua Baxter commented yesterday

When I call the text endpoint (For example: https://server//rm/publish/text?resourceURI=resourceURI1,resourceURI2&oslc_config.context=configContext) it returns raw, unstructured text instead of XML which is unfavorable for processing. However if I call the schema for the text endpoint, https://server/rm/publish/text?metadata=schema, the schema it returns is structured XML so I'm confused as to why the text endpoint is returning raw text



Davyd Norris commented yesterday | edited yesterday
Very weird - I've never seen raw text come back. Do you have any headers set? At very least I would set:

Accept: text/json or application/xml
Content-Type: application/json or application/xml

That may be why you're getting raw text back

EDIT: I've just tested the call for a resourceURI on my own server and, even with no headers set, I get XML returned. I think the problem may be with your code. Can you try something like POSTMAN?
showing 5 of 6 show 1 more comments

permanent link
Ralph Schoon (63.4k33646) | answered 2 days ago
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

There are the available API's: https://jazz.net/wiki/bin/view/Deployment/ELMProductAPILanding

For DNG there are several APIs. There are REST based Reportable REST and server APIs. There is an OSLC API. The documentation for the APIs can be found using the links. Some documentation might be lacking. OSLC is a standard and the standards documents can be found e.g. here: https://docs.oasis-open-projects.org/oslc-op/rm/v2.1/requirements-management-spec.html 

My blogs do not directly cover DNG, but OSLC and other APIs. The Authentication Wiki Entry Davyd mentions, is hopeless, I think. I spent some time creating https://rsjazz.wordpress.com/2021/10/15/elm-authentication/ which should be able to get you where you need be. https://rsjazz.wordpress.com/2021/09/29/using-the-ewm-rest-and-oslc-apis/ shows how the EWM REST APIs can be used. The principles apply to the DNG APIs as well and the article series should be able to help you getting started with DNG.


Comments
Ralph Schoon commented yesterday
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

Please note, in the case of OSLC, unless an attribute is a simple type such as String or integer etc, that has a standard representation, the attribute value will be a URL that would allow you to get the information needed. This could be the case for other APIs too. So, I am not aware of an API that would provide all data in one go.

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.