Missed Team ’24? Catch up on announcements here.

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

Sort order guarantee in get commits api

Devesh_Gossel April 27, 2020

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
AUG Leaders

Atlassian Community Events