It's all about the answers!

Ask a question

How to programmatically obtain snapshot details from respective Build Results?


Arun Batra (14612427) | asked Jun 30 '15, 12:19 p.m.
Hi,
We wanted to programmatically compare snapshots by providing the build IDs to which they are respectively attached.

To compare the snapshots we can use the RTC Command Line Interface.
But what do we use to get the snapshot ids from the build ids.

Obviously for this we would first need to populate a list of build results for a particular definition. This can be achieved using the REST API. (/jazz/resource/virtual/build/results)
However we are not able to find the id of the snapshot in the detail provided by the response above.

Are we missing something here or is this not possible by using REST API?
If not possible? How do we get the snapshot from the build id? Are there other ways?

Regards,
Arun

3 answers



permanent link
Krishna Kishore (50112) | answered Jul 01 '15, 1:08 a.m.
JAZZ DEVELOPER
Hi,

If you have the build result uuid then you can retrieve the build snapshot by getting the build contributions, following rest call should get the data 

<url>/resource/virtual/build/result/<build result uuid>/contributions?type=buildSnapshot
the result in JSON format would be like 

{
   "contributions":[
      {
         "contribution":{
            "impactsPrimaryResult":false,
            "label":"snapshot rtc.601_20150630-2158",
            "internalId":"_n_GaIB-UEeWRX78FKa6vpQ",
            "extendedContribution":{
               "etag":"_nuOFgB-UEeWRX78FKa6vpQ",
               "stateId":"_nuOFgB-UEeWRX78FKa6vpQ",
               "uri":"itemOid\/com.ibm.team.scm.BaselineSet\/_nuB4QB-UEeWRX78FKa6vpQ",
               "itemId":"_nuB4QB-UEeWRX78FKa6vpQ",
               "com.ibm.team.repository.typeName":"com.ibm.team.scm.BaselineSet"
            },
            "extendedContributionTypeId":"buildSnapshot"
         },
         "contentUri":"",
         "etag":null,
         "buildResultItemId":"_nDl0IB-UEeWRX78FKa6vpQ",
         "uri":"virtual\/build\/result\/_nDl0IB-UEeWRX78FKa6vpQ\/contribution\/_n_GaIB-UEeWRX78FKa6vpQ",
         "com.ibm.team.repository.typeName":"com.ibm.team.build.rest.BuildResultContributionDTO"
      }
   ],
....
....
}


permanent link
Nick Edgar (6.5k711) | answered Jul 06 '15, 2:43 p.m.
JAZZ DEVELOPER
You can also use the generateChangeLog Ant task:
http://www-01.ibm.com/support/knowledgecenter/#!/SSYMRC_5.0.2/com.ibm.team.build.doc/topics/r_generatechangelog.html

permanent link
Carlos Maciel (3112) | answered Jan 20 '16, 5:52 p.m.
Is there a way to obtain the snapshot information having the BuildResult (or BuildDefinition object) using Java Plain API?

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.