My requirement is to read/extract source code of each file present in an Azure DevOps pull request using APIs or C#. I am able to download the code for a particular file using sample URL below -
GET https://dev.azure.com/{organization}/{project}/_apis/git/repositories/{repositoryId}/items?path=/{CodePath}&version={branch name}&api-version=5.1
Now I need, list of files with location where it is stored in a branch of Azure DevOps
I have tried different GET calls from REST APIs available. For example:
GET https://dev.azure.com/{organization}/{project}/_apis/git/repositories/{repositoryId}/pullRequests/{pullRequestId}/iterations/{iterationId}?api-version=5.1
or
GET https://dev.azure.com/{organization}/{project}/_apis/git/repositories/{repositoryId}/pullRequests/{pullRequestId}/attachments/{fileName}?api-version=5.1-preview.1
These calls are returning information:
- About file commits
- About documents attached in description
Information I have to fulfill the requirement: Organization name, Repository name, Branch Name, Pull request ID