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

The Question is I would like to get the commits and pull requests in a certain time range.

Bharath Reddy
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
April 19, 2023

Hello Community,

 

I am on the way of creating Grafana Dashboards, I am trying to retrieve the commits for the repository only on a certain time range. May I please know if Bit Bucket cloud supports the since and until feature on the Api end points.

1 answer

0 votes
Ben
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
April 20, 2023

Hey Bharath,

Unfortunately - only some of what you are requesting is possible within our API at present.

Our /2.0/repositories endpoint does not support filtering by date for commits, however, you can use GIT commands to retrieve a list of commits since a certain date or before a certain date (you can add --count switch to just show the number):

git rev-list --all --since 2023-01-01
git rev-list --all --before 2023-01-01

As for pull requests, you can use filtering and sorting to pull this information - you will need to encode any query manually or using a tool to convert it to URL format, for example:

//This is the base query unencoded for > than a certain date and < than a certain date

https://api.bitbucket.org/2.0/repositories/{workspaceID}/{reposlug}/pullrequests?fields=values.id&q=updated_on<2023-01-01T00:00:00+00:00&state=ALL&pagelen=50

https://api.bitbucket.org/2.0/repositories/{workspaceID}/{reposlug}/pullrequests?fields=values.id&q=updated_on>2023-01-01T00:00:00+00:00&state=ALL&pagelen=50

//These are the same queries encoded in URL format

https://api.bitbucket.org/2.0/repositories/{workspaceID}/{reposlug}/pullrequests?fields=values.id&q=updated_on%3C2023-01-01T00%3A00%3A00%2B00%3A00&state=ALL&pagelen=50

https://api.bitbucket.org/2.0/repositories/{workspaceID}/{reposlug}/pullrequests?fields=values.id&q=updated_on%3D2023-01-01T00%3A00%3A00%2B00%3A00&state=ALL&pagelen=50

NOTE: You will need to remove the curly braces and replace these with actual values in your cURL command.

We have raised a feature request on your behalf to include date filtering in our commits endpoint:

Please feel free to "Watch" this request to receive updates related to it and "Vote" for it to improve its visibility with regard to customer demand, you can view our feature implementation policy below:

Hope this helps.

Cheers!

- Ben (Bitbucket Cloud Support)

Suggest an answer

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

Atlassian Community Events