Branches - Get Branch Refs

Get branch hierarchies below the specified scopePath

GET https://dev.azure.com/{organization}/{project}/_apis/tfvc/branches?scopePath={scopePath}&api-version=5.0
GET https://dev.azure.com/{organization}/{project}/_apis/tfvc/branches?scopePath={scopePath}&includeDeleted={includeDeleted}&includeLinks={includeLinks}&api-version=5.0

URI Parameters

Name In Required Type Description
organization
path True

string

The name of the Azure DevOps organization.

project
path

string

Project ID or project name

api-version
query True

string

Version of the API to use. This should be set to '5.0' to use this version of the api.

scopePath
query True

string

Full path to the branch. Default: $/ Examples: $/, $/MyProject, $/MyProject/SomeFolder.

includeDeleted
query

boolean

Return deleted branches. Default: False

includeLinks
query

boolean

Return links. Default: False

Responses

Name Type Description
200 OK

TfvcBranchRef[]

successful operation

Security

oauth2

Type: oauth2
Flow: accessCode
Authorization URL: https://app.vssps.visualstudio.com/oauth2/authorize&response_type=Assertion
Token URL: https://app.vssps.visualstudio.com/oauth2/token?client_assertion_type=urn:ietf:params:oauth:client-assertion-type:jwt-bearer&grant_type=urn:ietf:params:oauth:grant-type:jwt-bearer

Scopes

Name Description
vso.code Grants the ability to read source code and metadata about commits, changesets, branches, and other version control artifacts. Also grants the ability to search code and get notified about version control events via service hooks.

Examples

GET a list of branch refs
GET a list of branch refs including deleted
GET a list of branch refs with links

GET a list of branch refs

Sample Request

GET https://dev.azure.com/{organization}/_apis/tfvc/branches?scopePath=$/&api-version=5.0

Sample Response

{
  "count": 2,
  "value": [
    {
      "path": "$/Project01/ExampleFolder",
      "owner": {
        "displayName": "Chuck Reinhart",
        "url": "https://vssps.codedev.ms/e/MSFT/_apis/Identities/8c8c7d32-6b1b-47f4-b2e9-30b477b5ab3d",
        "id": "8c8c7d32-6b1b-47f4-b2e9-30b477b5ab3d",
        "uniqueName": "fabrikamfiber3@hotmail.com",
        "imageUrl": "https://codedev.ms/fabrikam/_api/_common/identityImage?id=8c8c7d32-6b1b-47f4-b2e9-30b477b5ab3d"
      },
      "createdDate": "2019-04-12T14:28:02.703Z",
      "url": "https://codedev.ms/fabrikam/_apis/tfvc/branches/$/Project01/ExampleFolder"
    },
    {
      "path": "$/Project01/ExampleFolder-branch",
      "description": "Sample Branch",
      "owner": {
        "displayName": "Chuck Reinhart",
        "url": "https://vssps.codedev.ms/e/MSFT/_apis/Identities/8c8c7d32-6b1b-47f4-b2e9-30b477b5ab3d",
        "id": "8c8c7d32-6b1b-47f4-b2e9-30b477b5ab3d",
        "uniqueName": "fabrikamfiber3@hotmail.com",
        "imageUrl": "https://codedev.ms/fabrikam/_api/_common/identityImage?id=8c8c7d32-6b1b-47f4-b2e9-30b477b5ab3d"
      },
      "createdDate": "2019-04-12T14:28:13.27Z",
      "url": "https://codedev.ms/fabrikam/_apis/tfvc/branches/$/Project01/ExampleFolder-branch"
    }
  ]
}

GET a list of branch refs including deleted

Sample Request

GET https://dev.azure.com/{organization}/_apis/tfvc/branches?scopePath=$/&includeDeleted=True&api-version=5.0

Sample Response

{
  "count": 3,
  "value": [
    {
      "path": "$/Project01/ExampleFolder",
      "owner": {
        "displayName": "Chuck Reinhart",
        "url": "https://vssps.codedev.ms/e/MSFT/_apis/Identities/8c8c7d32-6b1b-47f4-b2e9-30b477b5ab3d",
        "id": "8c8c7d32-6b1b-47f4-b2e9-30b477b5ab3d",
        "uniqueName": "fabrikamfiber3@hotmail.com",
        "imageUrl": "https://codedev.ms/fabrikam/_api/_common/identityImage?id=8c8c7d32-6b1b-47f4-b2e9-30b477b5ab3d"
      },
      "createdDate": "2019-04-12T14:28:02.703Z",
      "url": "https://codedev.ms/fabrikam/_apis/tfvc/branches/$/Project01/ExampleFolder"
    },
    {
      "path": "$/Project01/ExampleFolder-branch",
      "description": "Sample Branch",
      "owner": {
        "displayName": "Chuck Reinhart",
        "url": "https://vssps.codedev.ms/e/MSFT/_apis/Identities/8c8c7d32-6b1b-47f4-b2e9-30b477b5ab3d",
        "id": "8c8c7d32-6b1b-47f4-b2e9-30b477b5ab3d",
        "uniqueName": "fabrikamfiber3@hotmail.com",
        "imageUrl": "https://codedev.ms/fabrikam/_api/_common/identityImage?id=8c8c7d32-6b1b-47f4-b2e9-30b477b5ab3d"
      },
      "createdDate": "2019-04-12T14:28:13.27Z",
      "url": "https://codedev.ms/fabrikam/_apis/tfvc/branches/$/Project01/ExampleFolder-branch"
    },
    {
      "path": "$/Project01/ExampleFolder-branch1",
      "description": "Branched from $/Project01/ExampleFolder",
      "owner": {
        "displayName": "Chuck Reinhart",
        "url": "https://vssps.codedev.ms/e/MSFT/_apis/Identities/8c8c7d32-6b1b-47f4-b2e9-30b477b5ab3d",
        "id": "8c8c7d32-6b1b-47f4-b2e9-30b477b5ab3d",
        "uniqueName": "fabrikamfiber3@hotmail.com",
        "imageUrl": "https://codedev.ms/fabrikam/_api/_common/identityImage?id=8c8c7d32-6b1b-47f4-b2e9-30b477b5ab3d"
      },
      "createdDate": "2019-04-12T14:28:35.033Z",
      "isDeleted": true,
      "url": "https://codedev.ms/fabrikam/_apis/tfvc/branches/$/Project01/ExampleFolder-branch1"
    }
  ]
}

Sample Request

GET https://dev.azure.com/{organization}/_apis/tfvc/branches?scopePath=$/&includeLinks=True&api-version=5.0

Sample Response

{
  "count": 2,
  "value": [
    {
      "_links": {
        "self": {
          "href": "https://codedev.ms/fabrikam/_apis/tfvc/branches/$/Project01/ExampleFolder"
        },
        "owner": {
          "href": "https://vssps.codedev.ms/e/MSFT/_apis/Identities/8c8c7d32-6b1b-47f4-b2e9-30b477b5ab3d"
        }
      },
      "path": "$/Project01/ExampleFolder",
      "owner": {
        "displayName": "Chuck Reinhart",
        "url": "https://vssps.codedev.ms/e/MSFT/_apis/Identities/8c8c7d32-6b1b-47f4-b2e9-30b477b5ab3d",
        "id": "8c8c7d32-6b1b-47f4-b2e9-30b477b5ab3d",
        "uniqueName": "fabrikamfiber3@hotmail.com",
        "imageUrl": "https://codedev.ms/fabrikam/_api/_common/identityImage?id=8c8c7d32-6b1b-47f4-b2e9-30b477b5ab3d"
      },
      "createdDate": "2019-04-12T14:28:02.703Z",
      "url": "https://codedev.ms/fabrikam/_apis/tfvc/branches/$/Project01/ExampleFolder"
    },
    {
      "_links": {
        "self": {
          "href": "https://codedev.ms/fabrikam/_apis/tfvc/branches/$/Project01/ExampleFolder-branch"
        },
        "owner": {
          "href": "https://vssps.codedev.ms/e/MSFT/_apis/Identities/8c8c7d32-6b1b-47f4-b2e9-30b477b5ab3d"
        }
      },
      "path": "$/Project01/ExampleFolder-branch",
      "description": "Sample Branch",
      "owner": {
        "displayName": "Chuck Reinhart",
        "url": "https://vssps.codedev.ms/e/MSFT/_apis/Identities/8c8c7d32-6b1b-47f4-b2e9-30b477b5ab3d",
        "id": "8c8c7d32-6b1b-47f4-b2e9-30b477b5ab3d",
        "uniqueName": "fabrikamfiber3@hotmail.com",
        "imageUrl": "https://codedev.ms/fabrikam/_api/_common/identityImage?id=8c8c7d32-6b1b-47f4-b2e9-30b477b5ab3d"
      },
      "createdDate": "2019-04-12T14:28:13.27Z",
      "url": "https://codedev.ms/fabrikam/_apis/tfvc/branches/$/Project01/ExampleFolder-branch"
    }
  ]
}

Definitions

Name Description
IdentityRef
ReferenceLinks

The class to represent a collection of REST reference links.

TfvcBranchRef

Metadata for a branchref.

IdentityRef

Name Type Description
_links

ReferenceLinks

This field contains zero or more interesting links about the graph subject. These links may be invoked to obtain additional relationships or more detailed information about this graph subject.

descriptor

string

The descriptor is the primary way to reference the graph subject while the system is running. This field will uniquely identify the same graph subject across both Accounts and Organizations.

directoryAlias

string

displayName

string

This is the non-unique display name of the graph subject. To change this field, you must alter its value in the source provider.

id

string

imageUrl

string

inactive

boolean

isAadIdentity

boolean

isContainer

boolean

isDeletedInOrigin

boolean

profileUrl

string

uniqueName

string

url

string

This url is the full route to the source resource of this graph subject.

The class to represent a collection of REST reference links.

Name Type Description
links

object

The readonly view of the links. Because Reference links are readonly, we only want to expose them as read only.

TfvcBranchRef

Metadata for a branchref.

Name Type Description
_links

ReferenceLinks

A collection of REST reference links.

createdDate

string

Creation date of the branch.

description

string

Branch description.

isDeleted

boolean

Is the branch deleted?

owner

IdentityRef

Alias or display name of user

path

string

Path for the branch.

url

string

URL to retrieve the item.