Branches

TFS 2017 | TFS 2015 | TFS 2013

Note

Looking for REST APIS that support TFS 2018 or later versions? See the Azure DevOps REST API Reference.

api-version = 1.0

If you haven't already, look at the information on getting started with these APIs.

Get a branch

GET https://{instance}/DefaultCollection/_apis/tfvc/branches/{path}?api-version={version}[&includeChildren={bool}&includeParent={bool}&includeDeleted={bool}]
Parameter Type Default Notes
URL
instance string TFS server name ({server:port}).
path string $/ Full path to the branch.
Examples: $/, $/MyProject, $/MyProject/SomeFolder.
Query
api-version string Version of the API to use.
includeChildren bool false Return child branches, if there are any.
includeParent bool false Return the parent branch, if there is one.
includeDeleted bool false Return branches marked as deleted.

Sample request

GET https://mytfsserver/DefaultCollection/_apis/tfvc/branches/$/Fabrikam-Fiber-TFVC/AuthSample-Dev?api-version=1.0-preview.1

Sample response

{
  "path": "$/Fabrikam-Fiber-TFVC/AuthSample-dev",
  "description": "",
  "owner": {
    "id": "8c8c7d32-6b1b-47f4-b2e9-30b477b5ab3d",
    "displayName": "Chuck Reinhart",
    "uniqueName": "fabrikamfiber3@hotmail.com"
  },
  "createdDate": "2014-03-24T16:46:48.253Z",
  "relatedBranches": [],
  "mappings": []
}

With child branches

Sample request

GET https://mytfsserver/DefaultCollection/_apis/tfvc/branches/$/Fabrikam-Fiber-TFVC/AuthSample-Dev?includeChildren=true&api-version=1.0-preview.1

Sample response

{
  "_links": {
    "self": {
      "href": "https://mytfsserver/DefaultCollection/_apis/tfvc/branches/%24/Fabrikam-Fiber-TFVC/AuthSample-Dev"
    },
    "childBranches": {
      "href": "https://mytfsserver/DefaultCollection/_apis/tfvc/branches/%24/Fabrikam-Fiber-TFVC/AuthSample%2bSpecial"
    },
    "owner": {
      "href": "https://mytfsserver/DefaultCollection/_apis/Identities/8c8c7d32-6b1b-47f4-b2e9-30b477b5ab3d"
    }
  },
  "path": "$/Fabrikam-Fiber-TFVC/AuthSample-dev",
  "description": "",
  "owner": {
    "id": "8c8c7d32-6b1b-47f4-b2e9-30b477b5ab3d",
    "displayName": "Chuck Reinhart",
    "uniqueName": "fabrikamfiber3@hotmail.com",
    "url": "https://mytfsserver/DefaultCollection/_apis/Identities/8c8c7d32-6b1b-47f4-b2e9-30b477b5ab3d",
    "imageUrl": "https://mytfsserver/DefaultCollection/_api/_common/identityImage?id=8c8c7d32-6b1b-47f4-b2e9-30b477b5ab3d"
  },
  "createdDate": "2014-03-24T16:46:48.253Z",
  "url": "https://mytfsserver/DefaultCollection/_apis/tfvc/branches/%24/Fabrikam-Fiber-TFVC/AuthSample-Dev",
  "relatedBranches": [],
  "mappings": [],
  "children": [
    {
      "path": "$/Fabrikam-Fiber-TFVC/AuthSample+Special",
      "description": "Branched from $/Fabrikam-Fiber-TFVC/AuthSample-dev",
      "owner": {
        "id": "8c8c7d32-6b1b-47f4-b2e9-30b477b5ab3d",
        "displayName": "Chuck Reinhart",
        "uniqueName": "fabrikamfiber3@hotmail.com",
        "url": "https://mytfsserver/DefaultCollection/_apis/Identities/8c8c7d32-6b1b-47f4-b2e9-30b477b5ab3d",
        "imageUrl": "https://mytfsserver/DefaultCollection/_api/_common/identityImage?id=8c8c7d32-6b1b-47f4-b2e9-30b477b5ab3d"
      },
      "createdDate": "2014-03-24T16:52:10.407Z",
      "relatedBranches": [],
      "mappings": [],
      "children": []
    }
  ]
}

With the parent branch

Sample request

GET https://mytfsserver/DefaultCollection/_apis/tfvc/branches/$/Fabrikam-Fiber-TFVC/AuthSample-Dev?includeParent=true&api-version=1.0-preview.1

Sample response

{
  "path": "$/Fabrikam-Fiber-TFVC/AuthSample-dev",
  "description": "",
  "owner": {
    "id": "8c8c7d32-6b1b-47f4-b2e9-30b477b5ab3d",
    "displayName": "Chuck Reinhart",
    "uniqueName": "fabrikamfiber3@hotmail.com"
  },
  "createdDate": "2014-03-24T16:46:48.253Z",
  "parent": {
    "path": "$/Fabrikam-Fiber-TFVC/AuthSample"
  },
  "relatedBranches": [],
  "mappings": []
}

Deleted branch

Sample request

GET https://mytfsserver/DefaultCollection/_apis/tfvc/branches/$/Fabrikam-Fiber-TFVC/MyBranch?includeDeleted=true&api-version=1.0-preview.1

Sample response

{
  "path": "$/Fabrikam-Fiber-TFVC/MyBranch",
  "description": "Branched from $/Fabrikam-Fiber-TFVC/AuthSample",
  "owner": {
    "id": "8c8c7d32-6b1b-47f4-b2e9-30b477b5ab3d",
    "displayName": "Chuck Reinhart",
    "uniqueName": "fabrikamfiber3@hotmail.com"
  },
  "createdDate": "2014-03-24T16:44:13.277Z",
  "isDeleted": true,
  "relatedBranches": [
    {
      "path": "$/Fabrikam-Fiber-TFVC/AuthSample"
    }
  ],
  "mappings": []
}

Get a list of root branches

GET https://{instance}/DefaultCollection/_apis/tfvc/branches?api-version={version}[&includeChildren={bool}&includeDeleted={bool}]
Parameter Type Default Notes
URL
instance string TFS server name ({server:port}).
Query
api-version string Version of the API to use.
includeChildren bool false Return the child branches for each root branch.
includeDeleted bool false Return deleted branches.

Sample request

GET https://mytfsserver/DefaultCollection/_apis/tfvc/branches?api-version=1.0-preview.1

Sample response

{
  "count": 1,
  "value": [
    {
      "path": "$/Fabrikam-Fiber-TFVC/AuthSample",
      "owner": {
        "id": "8c8c7d32-6b1b-47f4-b2e9-30b477b5ab3d",
        "displayName": "Chuck Reinhart",
        "uniqueName": "fabrikamfiber3@hotmail.com",
        "url": "https://mytfsserver/DefaultCollection/_apis/Identities/8c8c7d32-6b1b-47f4-b2e9-30b477b5ab3d",
        "imageUrl": "https://mytfsserver/DefaultCollection/_api/_common/identityImage?id=8c8c7d32-6b1b-47f4-b2e9-30b477b5ab3d"
      },
      "createdDate": "2014-03-24T16:25:17.39Z",
      "url": "https://mytfsserver/DefaultCollection/_apis/tfvc/branches/%24/Fabrikam-Fiber-TFVC/AuthSample",
      "relatedBranches": [],
      "mappings": []
    }
  ]
}

With child branches

Sample request

GET https://mytfsserver/DefaultCollection/_apis/tfvc/branches?includeChildren=true&api-version=1.0-preview.1

Sample response

{
  "count": 1,
  "value": [
    {
      "path": "$/Fabrikam-Fiber-TFVC/AuthSample",
      "owner": {
        "id": "8c8c7d32-6b1b-47f4-b2e9-30b477b5ab3d",
        "displayName": "Chuck Reinhart",
        "uniqueName": "fabrikamfiber3@hotmail.com",
        "url": "https://mytfsserver/DefaultCollection/_apis/Identities/8c8c7d32-6b1b-47f4-b2e9-30b477b5ab3d",
        "imageUrl": "https://mytfsserver/DefaultCollection/_api/_common/identityImage?id=8c8c7d32-6b1b-47f4-b2e9-30b477b5ab3d"
      },
      "createdDate": "2014-03-24T16:25:17.39Z",
      "url": "https://mytfsserver/DefaultCollection/_apis/tfvc/branches/%24/Fabrikam-Fiber-TFVC/AuthSample",
      "relatedBranches": [],
      "mappings": [],
      "children": [
        {
          "path": "$/Fabrikam-Fiber-TFVC/AuthSample-dev",
          "description": "",
          "owner": {
            "id": "8c8c7d32-6b1b-47f4-b2e9-30b477b5ab3d",
            "displayName": "Chuck Reinhart",
            "uniqueName": "fabrikamfiber3@hotmail.com",
            "url": "https://mytfsserver/DefaultCollection/_apis/Identities/8c8c7d32-6b1b-47f4-b2e9-30b477b5ab3d",
            "imageUrl": "https://mytfsserver/DefaultCollection/_api/_common/identityImage?id=8c8c7d32-6b1b-47f4-b2e9-30b477b5ab3d"
          },
          "createdDate": "2014-03-24T16:46:48.253Z",
          "url": "https://mytfsserver/DefaultCollection/_apis/tfvc/branches/%24/Fabrikam-Fiber-TFVC/AuthSample-dev",
          "relatedBranches": [],
          "mappings": [],
          "children": [
            {
              "path": "$/Fabrikam-Fiber-TFVC/AuthSample+Special",
              "description": "Branched from $/Fabrikam-Fiber-TFVC/AuthSample-dev",
              "owner": {
                "id": "8c8c7d32-6b1b-47f4-b2e9-30b477b5ab3d",
                "displayName": "Chuck Reinhart",
                "uniqueName": "fabrikamfiber3@hotmail.com",
                "url": "https://mytfsserver/DefaultCollection/_apis/Identities/8c8c7d32-6b1b-47f4-b2e9-30b477b5ab3d",
                "imageUrl": "https://mytfsserver/DefaultCollection/_api/_common/identityImage?id=8c8c7d32-6b1b-47f4-b2e9-30b477b5ab3d"
              },
              "createdDate": "2014-03-24T16:52:10.407Z",
              "url": "https://mytfsserver/DefaultCollection/_apis/tfvc/branches/%24/Fabrikam-Fiber-TFVC/AuthSample%2bSpecial",
              "relatedBranches": [],
              "mappings": [],
              "children": []
            }
          ]
        }
      ]
    }
  ]
}

Including deleted branches

Sample request

GET https://mytfsserver/DefaultCollection/_apis/tfvc/branches?includeDeleted=true&api-version=1.0-preview.1

Sample response

{
  "count": 2,
  "value": [
    {
      "path": "$/Fabrikam-Fiber-TFVC/AuthSample",
      "owner": {
        "id": "8c8c7d32-6b1b-47f4-b2e9-30b477b5ab3d",
        "displayName": "Chuck Reinhart",
        "uniqueName": "fabrikamfiber3@hotmail.com",
        "url": "https://mytfsserver/DefaultCollection/_apis/Identities/8c8c7d32-6b1b-47f4-b2e9-30b477b5ab3d",
        "imageUrl": "https://mytfsserver/DefaultCollection/_api/_common/identityImage?id=8c8c7d32-6b1b-47f4-b2e9-30b477b5ab3d"
      },
      "createdDate": "2014-03-24T16:25:17.39Z",
      "url": "https://mytfsserver/DefaultCollection/_apis/tfvc/branches/%24/Fabrikam-Fiber-TFVC/AuthSample",
      "relatedBranches": [
        {
          "path": "$/Fabrikam-Fiber-TFVC/MyBranch"
        }
      ],
      "mappings": []
    },
    {
      "path": "$/Fabrikam-Fiber-TFVC/MyBranch",
      "description": "Branched from $/Fabrikam-Fiber-TFVC/AuthSample",
      "owner": {
        "id": "8c8c7d32-6b1b-47f4-b2e9-30b477b5ab3d",
        "displayName": "Chuck Reinhart",
        "uniqueName": "fabrikamfiber3@hotmail.com",
        "url": "https://mytfsserver/DefaultCollection/_apis/Identities/8c8c7d32-6b1b-47f4-b2e9-30b477b5ab3d",
        "imageUrl": "https://mytfsserver/DefaultCollection/_api/_common/identityImage?id=8c8c7d32-6b1b-47f4-b2e9-30b477b5ab3d"
      },
      "createdDate": "2014-03-24T16:44:13.277Z",
      "isDeleted": true,
      "url": "https://mytfsserver/DefaultCollection/_apis/tfvc/branches/%24/Fabrikam-Fiber-TFVC/MyBranch",
      "relatedBranches": [
        {
          "path": "$/Fabrikam-Fiber-TFVC/AuthSample"
        }
      ],
      "mappings": []
    }
  ]
}