Branches

Last Update: 12/5/2016

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 VS Team Services account ({account}.visualstudio.com) or TFS server ({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://Fabrikam-Fiber-inc.VisualStudio.com/DefaultCollection/_apis/tfvc/branches/$/Fabrikam-Fiber-TFVC/AuthSample-Dev?api-version=1.0-preview.1

Sample response

Status code: 200
{
  "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://fabrikam-fiber-inc.visualstudio.com/DefaultCollection/_apis/tfvc/branches/$/Fabrikam-Fiber-TFVC/AuthSample-Dev?includeChildren=true&api-version=1.0-preview.1

Sample response

Status code: 200
{
  "_links": {
    "self": {
      "href": "https://fabrikam-fiber-inc.visualstudio.com/DefaultCollection/_apis/tfvc/branches/%24/Fabrikam-Fiber-TFVC/AuthSample-Dev"
    },
    "childBranches": {
      "href": "https://fabrikam-fiber-inc.visualstudio.com/DefaultCollection/_apis/tfvc/branches/%24/Fabrikam-Fiber-TFVC/AuthSample%2bSpecial"
    },
    "owner": {
      "href": "https://fabrikam-fiber-inc.vssps.visualstudio.com/_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://fabrikam-fiber-inc.vssps.visualstudio.com/_apis/Identities/8c8c7d32-6b1b-47f4-b2e9-30b477b5ab3d",
    "imageUrl": "https://fabrikam-fiber-inc.visualstudio.com/DefaultCollection/_api/_common/identityImage?id=8c8c7d32-6b1b-47f4-b2e9-30b477b5ab3d"
  },
  "createdDate": "2014-03-24T16:46:48.253Z",
  "url": "https://fabrikam-fiber-inc.visualstudio.com/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://fabrikam-fiber-inc.vssps.visualstudio.com/_apis/Identities/8c8c7d32-6b1b-47f4-b2e9-30b477b5ab3d",
        "imageUrl": "https://fabrikam-fiber-inc.visualstudio.com/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://Fabrikam-Fiber-inc.VisualStudio.com/DefaultCollection/_apis/tfvc/branches/$/Fabrikam-Fiber-TFVC/AuthSample-Dev?includeParent=true&api-version=1.0-preview.1

Sample response

Status code: 200
{
  "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://Fabrikam-Fiber-inc.VisualStudio.com/DefaultCollection/_apis/tfvc/branches/$/Fabrikam-Fiber-TFVC/MyBranch?includeDeleted=true&api-version=1.0-preview.1

Sample response

Status code: 200
{
  "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 VS Team Services account ({account}.visualstudio.com) or TFS server ({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://fabrikam-fiber-inc.visualstudio.com/DefaultCollection/_apis/tfvc/branches?api-version=1.0-preview.1

Sample response

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

With child branches

Sample request

GET https://fabrikam-fiber-inc.visualstudio.com/DefaultCollection/_apis/tfvc/branches?includeChildren=true&api-version=1.0-preview.1

Sample response

Status code: 200
{
  "count": 1,
  "value": [
    {
      "path": "$/Fabrikam-Fiber-TFVC/AuthSample",
      "owner": {
        "id": "8c8c7d32-6b1b-47f4-b2e9-30b477b5ab3d",
        "displayName": "Chuck Reinhart",
        "uniqueName": "fabrikamfiber3@hotmail.com",
        "url": "https://fabrikam-fiber-inc.vssps.visualstudio.com/_apis/Identities/8c8c7d32-6b1b-47f4-b2e9-30b477b5ab3d",
        "imageUrl": "https://fabrikam-fiber-inc.visualstudio.com/DefaultCollection/_api/_common/identityImage?id=8c8c7d32-6b1b-47f4-b2e9-30b477b5ab3d"
      },
      "createdDate": "2014-03-24T16:25:17.39Z",
      "url": "https://fabrikam-fiber-inc.visualstudio.com/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://fabrikam-fiber-inc.vssps.visualstudio.com/_apis/Identities/8c8c7d32-6b1b-47f4-b2e9-30b477b5ab3d",
            "imageUrl": "https://fabrikam-fiber-inc.visualstudio.com/DefaultCollection/_api/_common/identityImage?id=8c8c7d32-6b1b-47f4-b2e9-30b477b5ab3d"
          },
          "createdDate": "2014-03-24T16:46:48.253Z",
          "url": "https://fabrikam-fiber-inc.visualstudio.com/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://fabrikam-fiber-inc.vssps.visualstudio.com/_apis/Identities/8c8c7d32-6b1b-47f4-b2e9-30b477b5ab3d",
                "imageUrl": "https://fabrikam-fiber-inc.visualstudio.com/DefaultCollection/_api/_common/identityImage?id=8c8c7d32-6b1b-47f4-b2e9-30b477b5ab3d"
              },
              "createdDate": "2014-03-24T16:52:10.407Z",
              "url": "https://fabrikam-fiber-inc.visualstudio.com/DefaultCollection/_apis/tfvc/branches/%24/Fabrikam-Fiber-TFVC/AuthSample%2bSpecial",
              "relatedBranches": [],
              "mappings": [],
              "children": []
            }
          ]
        }
      ]
    }
  ]
}

Including deleted branches

Sample request

GET https://fabrikam-fiber-inc.visualstudio.com/DefaultCollection/_apis/tfvc/branches?includeDeleted=true&api-version=1.0-preview.1

Sample response

Status code: 200
{
  "count": 2,
  "value": [
    {
      "path": "$/Fabrikam-Fiber-TFVC/AuthSample",
      "owner": {
        "id": "8c8c7d32-6b1b-47f4-b2e9-30b477b5ab3d",
        "displayName": "Chuck Reinhart",
        "uniqueName": "fabrikamfiber3@hotmail.com",
        "url": "https://fabrikam-fiber-inc.vssps.visualstudio.com/_apis/Identities/8c8c7d32-6b1b-47f4-b2e9-30b477b5ab3d",
        "imageUrl": "https://fabrikam-fiber-inc.visualstudio.com/DefaultCollection/_api/_common/identityImage?id=8c8c7d32-6b1b-47f4-b2e9-30b477b5ab3d"
      },
      "createdDate": "2014-03-24T16:25:17.39Z",
      "url": "https://fabrikam-fiber-inc.visualstudio.com/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://fabrikam-fiber-inc.vssps.visualstudio.com/_apis/Identities/8c8c7d32-6b1b-47f4-b2e9-30b477b5ab3d",
        "imageUrl": "https://fabrikam-fiber-inc.visualstudio.com/DefaultCollection/_api/_common/identityImage?id=8c8c7d32-6b1b-47f4-b2e9-30b477b5ab3d"
      },
      "createdDate": "2014-03-24T16:44:13.277Z",
      "isDeleted": true,
      "url": "https://fabrikam-fiber-inc.visualstudio.com/DefaultCollection/_apis/tfvc/branches/%24/Fabrikam-Fiber-TFVC/MyBranch",
      "relatedBranches": [
        {
          "path": "$/Fabrikam-Fiber-TFVC/AuthSample"
        }
      ],
      "mappings": []
    }
  ]
}