question

AmberLiu-0522 avatar image
0 Votes"
AmberLiu-0522 asked MayankBargali-MSFT edited

How to get the oldest commit of a specific BuildId via [Get Build Changes] API

Tried to get the oldest commit from a specific build.

https://dev.azure.com/{organization}/{project}/_apis/build/builds/{buildId}/changes?continuationToken={continuationToken}&api-version=6.0

The [Get Build Changes] API above seems to be the proper API to be used. However, it defaults to return the latest 50 commits of the build.

This made me have to send more API requests with the response header [x-microsoft-continuation] for next 50 commits until the last page to get the oldest commit of the build, which is not that efficient for my use case.

Would you please suggest if there is any easier way (less API calls) that I could use to get the oldest commit of a specific build?

Here are also one more questions : Is there any easier way to know the total number of commits for a specific build?


not-supported
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

MayankBargali-MSFT avatar image
0 Votes"
MayankBargali-MSFT answered

Hi @AmberLiu-0522

Welcome to Microsoft Q&A! Thanks for posting the question.

DevOps is currently not supported in the Q&A forums, the supported products are listed over here https://docs.microsoft.com/en-us/answers/products (more to be added later on).

You can ask the experts in the dedicated forum over here:
https://stackoverflow.com/questions/tagged/devops
https://developercommunity.visualstudio.com/spaces/21/index.html

Please 'Accept as answer' and ‘Upvote’ if it helped so that it can help others in the community looking for help on similar topics.

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.