Currently, when configuring a webhook to trigger on a code push event in Bitbucket Cloud, the payload does not include information about the specific files that have changed. Does Bitbucket Cloud provide a dedicated API endpoint to directly retrieve the changed, added, or deleted files between two commits?
I have done some search and identified the following endpoint which includes all the changes which is not scalable.
https://api.bitbucket.org/2.0/repositories/{workspace}/{repo}/diff/{commit1}..{commit2}
Hello @yashodperera ,
Thank you for reaching out to Atlassian Community!
I think what you are looking for can be achieved using the diff stat endpoint :
This endpoint should return a JSON object containing all the files that were added,removed,modified or renamed by comparing two commits.
Following is an example of an API call using that endpoint, which will compare the files changed between two commits :
curl -X GET -u USERNAME:APPPASSWORD https://api.bitbucket.org/2.0/repositories/<workspace>/<repository>/diffstat/f179ff7..00f0e77
The first commit is the commit you want to see the changes. The second commit represents the state to which we want to compare the first commit.
If you provide only one commit ID to that endpoint, it will calculate the diff spec against the first parent of the specified commit.
Hope that helps! Let me know in case you have any questions.
Thank you, @yashodperera !
Patrik S
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.