It's all about the answers!

Ask a question

How to fetch "Modified By" from a DNG Resource with REST API


Chid . (2052961) | asked Dec 23 '21, 1:21 a.m.

I wanted to printed the last Modified By a DNG Resource in RPE.

Type System of the component shows an Attributes named Contributor. Does this store the last Modified By value ?
Reportable REST API shows creator, created, modified timestamp, but not the Modified By.

2 answers



permanent link
Ian Barnard (1.2k613) | answered Dec 23 '21, 3:39 a.m.
JAZZ DEVELOPER
edited Dec 23 '21, 11:49 a.m.

Hi Chid


You don't say which version/ifix you're using - details below are from 7.0.2 iFix009, but I'm not aware this has changed recently.

Reportable REST API shows creator, created, modified timestamp, but not the Modified By.

More precisely, "DOORS Next Reportable REST API for resources shows creator, created, modified timestamp, but not the Modified By."

However the DN reportable rest output for resources includes a tag collaboration/revisions/href like this:
Use the href which is to the Reportable REST API for revisions and you get the revisions which includes the author of the revision like this:

    <ds:artifact attribute:itemId="TX1zGPUB6Eeuh3Iiax2L3Ow">
        <rrm:title attribute:itemId="title">Operations</rrm:title>
        <rrm:description attribute:itemId="description"/>
        <rrm:identifier attribute:itemId="identifier">4197</rrm:identifier>
        <rrm:about>https://jazz.ibm.com:9443/rm/resources/TX1zGPUB6Eeuh3Iiax2L3Ow</rrm:about>
        <rrm:format attribute:itemId="ArtifactFormat">Text</rrm:format>
        <rrm:core/>
        <rrm:collaboration>
            <rrm:creator attribute:itemId="creator">
                <rrm:about>https://jazz.ibm.com:9443/jts/users/ibm</rrm:about>
                <rrm:title>IBM</rrm:title>
            </rrm:creator>
            <rrm:created attribute:itemId="created">2020-12-17T15:18:11.127+0000</rrm:created>
            <rrm:modified attribute:itemId="modified">2020-12-17T15:18:11.127+0000</rrm:modified>
            <rrm:attributes>
                <attribute:objectType attribute:itemId="OTx7TK0B6Eeuh3Iiax2L3Ow"
                                        attribute:name="Heading"
                                        attribute:projectAreaItemId="_-_28tkB6Eeuh3Iiax2L3Ow"
                                        attribute:projectAreaName="rm_optout_p1">
                    <attribute:customAttribute attribute:datatype="http://www.w3.org/2001/XMLSchema#int"
                                                 attribute:isMultiValued="false"
                                                 attribute:itemId="identifier"
                                                 attribute:name="Identifier"
                                                 attribute:value="4197"
                                                 attribute:valueTS=""/>
                </attribute:objectType>
            </rrm:attributes>
            <rrm:comments>
                <rrm:href>https://jazz.ibm.com:9443/rm/publish/comments?resourceURI=https://jazz.ibm.com:9443/rm/resources/TX1zGPUB6Eeuh3Iiax2L3Ow</rrm:href>
            </rrm:comments>
            <rrm:revisions>
                <rrm:href>https://jazz.ibm.com:9443/rm/publish/revisions?resourceURI=https://jazz.ibm.com:9443/rm/resources/TX1zGPUB6Eeuh3Iiax2L3Ow</rrm:href>
                <rrm:about>https://jazz.ibm.com:9443/rm/resources/TX1zGPUB6Eeuh3Iiax2L3Ow?revision=E0-9vkB7Eeuh3Iiax2L3Ow</rrm:about>
            </rrm:revisions>
        </rrm:collaboration>
        <ds:location>
            <ds:project>
                <rrm:title>rm_optout_p1</rrm:title>
                <rrm:about>https://jazz.ibm.com:9443/rm/resource/itemOid/com.ibm.team.process.ProjectArea/-28tkB6Eeuh3Iiax2L3Ow</rrm:about>
                <rrm:alternative>https://jazz.ibm.com:9443/rm/process/project-areas/-_28tkB6Eeuh3Iiax2L3Ow</rrm:alternative>
            </ds:project>
            <ds:component>
                <rrm:title>rm_optout_p1</rrm:title>
                <rrm:about>https://jazz.ibm.com:9443/rm/cm/component/J_JEEB6Eeuh3Iiax2L3Ow</rrm:about>
            </ds:component>
            <ds:parentFolder>
                <rrm:title>Software Requirements Specification Template artifacts</rrm:title>
                <rrm:about>https://jazz.ibm.com:9443/rm/folders/FRx7S_UB6Eeuh3Iiax2L3Ow</rrm:about>
            </ds:parentFolder>
        </ds:location>
    </ds:artifact>

Use the href which is to the Reportable REST API for revisions and you get the details of all revisions for that artifact, like this:

    <ds:artifact attribute:itemId="MDy90_0B6Eeuh3Iiax2L3Ow">
       ....
        <ds:content>
            <revision:revision action="">
                <revision:title>https://jazz.ibm.com:9443/rm/resources/MDy90_0B6Eeuh3Iiax2L3Ow?revision=_tWUoMGPHEeyqM6csspU9MA</revision:title>
                <revision:author>https://jazz.ibm.com:9443/jts/users/fred</revision:author>
                <revision:id>urn:uuid:MDy90_0B6Eeuh3Iiax2L3Ow?revision=_tWUoMGPHEeyqM6csspU9MA</revision:id>
                <revision:updated>2021-12-23T08:09:54.053+0000</revision:updated>
            </revision:revision>
            <revision:revision action="">
                <revision:title>https://jazz.ibm.com:9443/rm/resources/MDy90_0B6Eeuh3Iiax2L3Ow?revision=_KMTnBUB7Eeuh3Iiax2L3Ow</revision:title>
                <revision:author>https://jazz.ibm.com:9443/jts/users/ibm</revision:author>
                <revision:id>urn:uuid:MDy90_0B6Eeuh3Iiax2L3Ow?revision=_KMTnBUB7Eeuh3Iiax2L3Ow</revision:id>
                <revision:updated>2020-12-17T15:18:50.580+0000</revision:updated>
            </revision:revision>
            <revision:revision action="">
                <revision:title>https://jazz.ibm.com:9443/rm/resources/MDy90_0B6Eeuh3Iiax2L3Ow?revision=_EiDZ-EB7Eeuh3Iiax2L3Ow</revision:title>
                <revision:author>https://jazz.ibm.com:9443/jts/users/ibm</revision:author>
                <revision:id>urn:uuid:MD__y90_0B6Eeuh3Iiax2L3Ow?revision=_EiDZ-EB7Eeuh3Iiax2L3Ow</revision:id>
                <revision:updated>2020-12-17T15:18:12.611+0000</revision:updated>
            </revision:revision>
        .....


Update:

If the revisions are in a configuration-managed project then adding  &oslc_config.context=https://host:port/gc/configuration/4462 is the correct way to specify configuration. Not sure where you got header oslc.configuration from but that's not right. Not sure Reportable rest uses a header for configuration at all. If it does the correct header would most likely be Configuration.Context

If you get 200 with no content in the XML (i.e. response body is <ds:dataSource appId="RRC" rrm:totalCount="1" vMajor="60" vMinor="06"/>) it's because there's nothing for that resource in that configuration - check the resource URI is correct and present in that configuration. If the configuration is wrong (doesn't exist) I get a 404.

> Is it possible to fetch only the last change of an artifact.

Not AFAIK in the Reportable REST API.

As an alternative you could retrieve the artifact using the OSLC API - you have its URL in the reportable REST. Ensure you provide headers OSLC-Core-Version: 2.0 and Accept: application/rdf+xml - modifier is in the result in tag dcterms:contributor. The OSLC URL for the artifact is in the rrm:about tag. You'll need to add the query parameter oslc_config.context= configuration URL.

Or you use OSLC Query instead of Reportable REST because then you can request the contributor in the query results with the artifact. OSLC Query is a rather different ballgame, not sure if/how you can do OSLC Query from RPE.

HTH
Ian


Comments
Chid . commented Dec 23 '21, 10:57 a.m. | edited Dec 23 '21, 10:58 a.m.
Thank you for the detailed reply.

How to get the OSLC URL of the artifact from the response of Reportable REST.


Ian Barnard commented Dec 23 '21, 11:49 a.m.
JAZZ DEVELOPER

See updated answer 


permanent link
Chid . (2052961) | answered Dec 23 '21, 4:17 a.m.

I am using RDNG 6.0.6.1-I20190326_1835 iFix020 + TFR 100219v4.


This call provides the complete Audit History & the response is slow, like in UI. This xml has the "Modified By" for each change.

https://host:port/rm/publish/resources?resourceURI=_TpjHQUXnEeyydYNlRC_1mA
&history=true
&oslc_config.context=https://host:port/gc/configuration/4462

Is it possible to fetch only the last change of an artifact.

I tried with the revisions href also. I was not sure on how to add the config.context. Following gave a 200 response but did not have any data.


Instead of using oslc_config.context in the URI query param, I also tried oslc.configuration as a header; responded with 200; but no data in the response.

I am testing these API with REST Client.


Comments
Ian Barnard commented Dec 23 '21, 5:37 a.m.
JAZZ DEVELOPER

Please use comments or update/edit your question rather than adding an "answer" which is just an extension of your question. See my updated answer. 

Your answer


Register or to post your answer.