How do I get list of changed files from one commit to another commit in bitbucket api

Sri Harsha Gangavelli
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
January 18, 2024

Hi,

 

I need to get list of file changes from one commit sha to another commit sha or a branch. I found similar API but it will work only for two specific commits(prev,next) for compare diffstat. I can have n no. of commits in between from commit and to commit,  please let me know if any API gives all changes at one go instead of triggering the same API with each commit id every time.

Attached screenshot for reference.

Below is the Azure DevOps API which provides similar case. For n no. of commits we can give from and to and get all the changes files.

https://dev.azure.com/{organization}/{project}/_apis/git/repositories/{repo_id}/diffs/commits?baseVersion={from_commit_id}&baseVersionType=commit&targetVersion={branch_name}&targetVersionType=branch&api-version=7.1-preview.1&%24top={max_page_size}

 

Screenshot 2024-01-19 064210.png

 

1 answer

0 votes
Mark C
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
January 23, 2024

Hi @Sri Harsha Gangavelli,

Welcome to the community.

I understand that you're using the /diffstat API endpoint to view file changes from one commit to another, however, you'd like to have the result all at once.
Depending on the number of data, you can try to increase the number of API data resulting in one API call up to 100. - https://developer.atlassian.com/cloud/bitbucket/rest/intro/#pagination

However, if it goes beyond 100, unfortunately, you'll have to run multiple API calls to get all the results.

Let me know if you have any further questions.

Regards,
Mark C

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events