could someone tell a way to get file contents through rest api in azure devops? I tried in this way but it isnt getting proper results.
2 Answers
It should be in this format https://dev.azure.com/{organization}/{project}/_apis/sourceProviders/{providerName}/filecontents?api-version=5.0-preview.1
Service endpoint should be TFGit as per the documentation here
3 Comments
Sudhakar Mangipudi
Also found this is working, in case you just need file contents dev.azure.com{{Organization}}/{{ProjectName}//_apis/git/repositories/{{RepoName}}/items?versionDescriptor.version={{BranchName}}&path={{FilePathwithName}}&api-version=5.0 It downloads the content, we need to pipe that to output file or any object based on your programming language.
Mik
What exactly is {providerName}?
Sudhakar Mangipudi
@Mik Provider is the version control service. In my case it is "tfsGit" example: dev.azure.com/MyOrganization/MyProject/_apis/sourceProviders/…