It's all about the answers!

Ask a question

Retrieving the raw file from a changeset using the REST API


Spencer Clark (1114) | asked May 09 '16, 11:18 a.m.
 I have built a small python program for playing around with defects. I am able to pull the changeset collection from  a defect and view the JSON file from the changeset:
 "{
  \"modifiedBy\": {
    \"uri\": \"itemOid\\\/com.ibm.team.repository.Contributor\\\/_-jH3wEslEeWIwpv-V-YAdQ\",
    \"itemId\": \"_-jH3wEslEeWIwpv-V-YAdQ\",
    \"com.ibm.team.repository.typeName\": \"com.ibm.team.repository.Contributor\"
  },
  \"changes\": [
    {
      \"item\": {
        \"uri\": \"itemOid\\\/com.ibm.team.filesystem.FileItem\\\/__5o0cB46EeSVP4AOyaueFQ\",
        \"itemId\": \"__5o0cB46EeSVP4AOyaueFQ\",
        \"com.ibm.team.repository.typeName\": \"com.ibm.team.filesystem.FileItem\"
      },
      \"kind\": 2,
      \"internalId\": \"_BoAmYKQNEeW8tvYITYLrgw\",
      \"merges\": [
        {
          \"state\": \"_RSx_xKNVEeW8tvYITYLrgw\",
          \"kind\": 2,
          \"internalId\": \"_Eu--YKQNEeW8tvYITYLrgw\"
        },
        {
          \"state\": \"_uhcTxPTpEeWwxYsnqAeZMw\",
          \"kind\": 2,
          \"internalId\": \"_RHgJoPWjEeWwxYsnqAeZMw\"
        }
      ],
      \"after\": \"_QvOzlPWjEeWwxYsnqAeZMw\",
      \"before\": \"_Fo6TSI4YEeWx7vJbV417Gw\"
    }
  ],
  \"originalSourceType\": 0,
  \"active\": false,
  \"originalSourceId\": null,
  \"modified\": \"2016-03-29T14: 17: 55.200Z\",
  \"predecessor\": \"_RHgJofWjEeWwxYsnqAeZMw\",
  \"contextId\": \"_Dp6kMdwTEd2jUupDpQV1Rw\",
  \"uri\": \"itemOid\\\/com.ibm.team.scm.ChangeSet\\\/_BkszsKQNEeW8tvYITYLrgw\",
  \"stateId\": \"_B7kI-fW5EeWwxYsnqAeZMw\",
  \"itemId\": \"_BkszsKQNEeW8tvYITYLrgw\",
  \"mergePredecessor\": null,
  \"properties\": [
    
  ],
  \"lastUpdatedDate\": \"2016-03-29T14: 17: 55.152Z\",
  \"owner\": {
    \"uri\": \"itemOid\\\/com.ibm.team.repository.Contributor\\\/_-jH3wEslEeWIwpv-V-YAdQ\",
    \"itemId\": \"_-jH3wEslEeWIwpv-V-YAdQ\",
    \"com.ibm.team.repository.typeName\": \"com.ibm.team.repository.Contributor\"
  },
  \"sourceType\": 0,
  \"etag\": \"_B7kI-fW5EeWwxYsnqAeZMw\",
  \"sourceId\": null,
  \"component\": {
    \"uri\": \"itemOid\\\/com.ibm.team.scm.Component\\\/_ouBTQE53EeCaGOtM6Ru5Tg\",
    \"itemId\": \"_ouBTQE53EeCaGOtM6Ru5Tg\",
    \"com.ibm.team.repository.typeName\": \"com.ibm.team.scm.Component\"
  },
  \"xComponentLink\": null,
  \"comment\": \"Merges 10.1 pom changes with current development\",
  \"com.ibm.team.repository.typeName\": \"com.ibm.team.scm.ChangeSet\"
}"

Now, I want to pull a copy of the file from this json file. What is the URL I need to compose to get the file? 

Thanks. 

Comments
Donald Nong commented May 10 '16, 2:30 a.m.

Try the URI that has "com.ibm.team.filesystem.FileItem" in it.

One answer



permanent link
Atul Kumar (1872329) | answered May 10 '16, 7:55 a.m.
There is a similar discussion here - https://jazz.net/forum/questions/38090/get-files-referred-in-a-change-set-via-rest-apis

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.