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

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Sort order guarantee in get commits api

My use case is to get the commits after certain date. And I need it for both bitbucket server (API 1.0) and bitbucket cloud (API 2.0).

I came to know through api documentation that the commits api do not provide query parameters to filter the commits in a date range.

So I am thinking for a workaround to achieve this. The workaround will be to get the paginated results and check the commit date of last commit in the page. If commit date is less than the given date, stop calling the api for further commits.

But for this to work, the api should return the commits in "newest commits first" sort order. I checked the api response and found that the commits are in newest first order only.

In API 2.0, it is also written in the documentation that it returns all commits in the repo in topological order (newest commit first). While in API 1.0, it is not written so clearly.

As my workaround relies on sort order, my question is that is it guaranteed or not that this sort order (newest commit first) will not be changed in future for both API 1.0 and 2.0?

Api documentation links I referred to:

Bitbucket server API 1.0 : https://docs.atlassian.com/bitbucket-server/rest/7.1.1/bitbucket-rest.html#idp213

Bitbucket cloud API 2.0: https://developer.atlassian.com/bitbucket/api/2/reference/resource/repositories/%7Bworkspace%7D/%7Brepo_slug%7D/commits#get

 

 

 

 

 

 

0 answers

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Bitbucket

New improvements to user management in Bitbucket Cloud 👥

Hey Community! We’re willing to wager that quite a few of you not only use Bitbucket, but administer it too. Our team is excited to share that we’ll be releasing improvements throughout this month of...

3,845 views 10 16
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you