How do I filter list of commits from REST API v2

rest-api

#1

Referring to https://developer.atlassian.com/bitbucket/api/2/reference/resource/repositories/{username}/{repo_slug}/commits, I’d like to be able to list commits after a particular date or commit hash. I have tried using the querystring since, created_on, date to no avail.

Any help is very much appreciated. Thanks.


#2

Unfortunately, at this time it is not possible. Erik originally meant to implement this so I don’t think it’s out of the realm of possibility but I don’t want to make promises about future implementations.


#3

Thanks @sfarley for the prompt response. So for now if i want to get a list of yesterday’s commits, I will have to page through the whole list of commits. This sounds terribly inefficient and may cause unnecessary loads on the Bitbucket Cloud server.

Do you foresee any other more efficient approach to achieving the same result?


#4

It’d be the same load on our servers with or without filtering (the expensive part is walking the DAG from disk). The most efficient approach, by far, is to keep a local clone and pull the new commits. It’s guaranteed to be optimal at that point.


#5

Thanks @sfarley
Cloning the repo is not possible in the PaaS that I am using as there is no local disk access. I hope you will consider adding the since/after/until/before params to filter. In the meanwhile, I will traverse the whole history from oldest to newest commits everytime I want to retrieve the latest commits via the REST API.