Rohi_Dev_1.0
Rohi_Dev_1.0

Reputation: 386

Get Branch items using VSTS Git API C#

I want to download all contents from Git Branch using VSTS Git API. I have successfully downloaded item using https://learn.microsoft.com/en-us/rest/api/vsts/git/items/get but It always pointing to master branch. I want to point to another branch.

I got the solution - by passing branch name in "versionDescriptor.version" parameter we can get the item from specific branch

Upvotes: 2

Views: 1431

Answers (1)

Daniel Mann
Daniel Mann

Reputation: 58980

The documentation states that there are optional parameters you can provide to the REST request:

versionDescriptor.version string Version string identifier (name of tag/branch, SHA1 of commit)

versionDescriptor.versionType GitVersionType Version type (branch, tag, or commit). Determines how Id is interpreted

Simply append the parameters &versionDescriptor.versionType=branch&versionDescriptor.version=[name of the branch].

Upvotes: 2

Related Questions