I use the REST API to retrieve the change set from a project. I get for example the following response:

{
  "changes": [
    {
      "kind": 2,
      "item": {
        "uri": "itemOid\/com.ibm.team.filesystem.FileItem\/_2ItWACJKEeGAaaEbbqTtgw",
        "itemId": "_2ItWACJKEeGAaaEbbqTtgw",
        "com.ibm.team.repository.typeName": "com.ibm.team.filesystem.FileItem"
      },
      "before": "_Rx7-BCJaEeG25dOp_iUerQ",
      "after": "_Ngn9BCJeEeG25dOp_iUerQ",
      "internalId": "_NhCzwCJeEeG25dOp_iUerQ"
    },
    {
      "kind": 1,
      "item": {
        "uri": "itemOid\/com.ibm.team.filesystem.FileItem\/_GWB-kCJeEeGAaaEbbqTtgw",
        "itemId": "_GWB-kCJeEeGAaaEbbqTtgw",
        "com.ibm.team.repository.typeName": "com.ibm.team.filesystem.FileItem"
      },
      "before": null,
      "after": "_Ngn9CyJeEeG25dOp_iUerQ",
      "internalId": "_NhCzwSJeEeG25dOp_iUerQ"
    }
  ],
  "comment": "",
  "lastUpdatedDate": "2011-12-09T12:06:52.266Z",
  "active": false,
  "owner": {
    "uri": "itemOid\/com.ibm.team.repository.Contributor\/_hhbosPC1EeCsJbI2ZgPDog",
    "itemId": "_hhbosPC1EeCsJbI2ZgPDog",
    "com.ibm.team.repository.typeName": "com.ibm.team.repository.Contributor"
  },
  "com.ibm.team.repository.typeName": "com.ibm.team.scm.ChangeSet",
  "stateId": "_R7C54SJeEeG25dOp_iUerQ",
  "component": {
    "uri": "itemOid\/com.ibm.team.scm.Component\/_auolkPC9EeCek69P-ztT9w",
    "itemId": "_auolkPC9EeCek69P-ztT9w",
    "com.ibm.team.repository.typeName": "com.ibm.team.scm.Component"
  },
  "contextId": "_Dp6kMdwTEd2jUupDpQV1Rw",
  "predecessor": "_NhCzwiJeEeG25dOp_iUerQ",
  "modified": "2011-12-09T12:06:52.288Z",
  "mergePredecessor": null,
  "uri": "itemOid\/com.ibm.team.scm.ChangeSet\/_Nb_UoCJeEeG25dOp_iUerQ",
  "itemId": "_Nb_UoCJeEeG25dOp_iUerQ",
  "properties": [

  ],
  "modifiedBy": {
    "uri": "itemOid\/com.ibm.team.repository.Contributor\/_hhbosPC1EeCsJbI2ZgPDog",
    "itemId": "_hhbosPC1EeCsJbI2ZgPDog",
    "com.ibm.team.repository.typeName": "com.ibm.team.repository.Contributor"
  },
  "xComponentLink": null,
  "etag": "_R7C54SJeEeG25dOp_iUerQ"
}

Now I want to find the source code files as well as the changes. But how can I do it? When i try to send a HTTP Get to the uri in the list changes, then I get a Bad Request 400 error. What can I do?

有帮助吗?

解决方案

The rest call you are calling is probably not API - use it at your own risks. Format will most likely change in future. I assume you found about that rest call while using the Source Control Web UI. You can go to the history view, look at a change, go to an after or before state. This takes you to the state view. Right click on the download link. This is one way to get the URI needed to fetch the content associated to a particular state referenced in a change in a change set. This should get you on the way.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top