Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,559,151
Community Members
 
Community Events
184
Community Groups

How do I get the list of files that were updated in a commit using bitbucket API 2.0?

I am working on creating a CI/CD pipeline. Once files are committed to my bitbucket repo, I want to be able to 

  1. Fetch the commit I want to (I can do that using the commits API with include/exclude).
  2. Get all files that were updated under that specific commit! (I"M LOOKING FOR A WAY TO FETCH THIS using API 2.0).

1 answer

0 votes
Mateus T
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
Aug 23, 2022

Hi @Saurabh Porwal,

Welcome to the Atlassian Community!

From the commits API, the results should also include a section with several links. Among those links, you have the option to grab the link for either the diff, or patch. The diff API should bring you the actual diff of that commit, allowing you to work out the files modified in this commit:

Curl -X GET "https://api.bitbucket.org/2.0/repositories/<workspace>/<repository>/diff/<commit>

In counterpart, the patch link should also contain a diff summary with all the files modified before showing the diff, so that could make it easier for you to parse the changes:

Curl -X GET "https://api.bitbucket.org/2.0/repositories/<workspace>/<repository>/patch/<commit>

Cheers,

Mateus T

Thanks @Mateus T both these APIs return the difference or patch and do have the file names but are in text format. I'm looking for an API response which could cleanly give me just filenames with path that have been updated preferably in JSON format so that is easier to parse and automate with any programming language.

Mateus T
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
Aug 23, 2022

@Saurabh Porwal,

Gotcha! I definitely see how the JSON format would make that easier.

For now, those endpoints are the best way to get those files in a specific commit. I did find an open feature request in our public bug tracker which you can check through the following here.

Our development team will give a first-hand update through that ticket if there's any progress made so I would suggest keeping a watch for it. Please note that all enhancements are implemented with this policy in mind.

Cheers,

Mateus T

Suggest an answer

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

Atlassian Community Events