Spartan87
Spartan87

Reputation: 119

Get file names in a commit in azure devops using rest api c#

I am trying to get the list of files that changed in a commit in AzureDevOps. Is there an api to get this information ?

I am using this but not able to get the information for files.

https://learn.microsoft.com/en-us/rest/api/azure/devops/build/attachments/get?view=azure-devops-rest-6.0

var attachment = buildClient.GetAttachmentsAsync(projectName, buildRunId, commititem.Type).Result;

The above code returns empty value.

Upvotes: 1

Views: 1425

Answers (1)

Kevin Lu-MSFT
Kevin Lu-MSFT

Reputation: 35194

Is there an api to get this information ?

Yes. You can get the file names in a commit with this API: Commits - Get Changes

GET https://dev.azure.com/{organization}/{project}/_apis/git/repositories/{repositoryId}/commits/{commitId}/changes?api-version=6.0

For .net sdk, you can refer to this class: GitCommitChanges Class

Upvotes: 1

Related Questions