Bitbucket API v2 pipeline query: dates in a specific interval

Radu Cristescu February 7, 2025

I would like to get the list of pipelines created in a certain time interval, but right now that doesn't appear to work.

I tried using the information on the Filter and sort API objects page, but I'm unsuccessful.

This is what the URL looks like:

https://api.bitbucket.org/2.0/repositories/<workspace>/<repository>/pipelines?q=created_on >= 2025-01-01T00:00:00 AND created_on < 2025-02-01T00:00:00&fields=values.build_seconds_used,values.created_on,values.completed_on,values.run_creation_date,next,size&sort=-created_on

The value of `q` is completely ignored.

Additionally, the `next` in the reponse loses my `sort` and `fields`, so I can't rely on it for iteration.

Am I doing something wrong, or does `q` not work at all?


Personally I'd prefer if Bitbucket provided a dashboard showing where all the build minutes went, but until that happens, I may have to write my own.

1 answer

1 accepted

0 votes
Answer accepted
Syahrul
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
February 10, 2025

G'day, @Radu Cristescu 

Welcome to the community!

Have you tried using the Build statistic pipe to review your pipeline build minutes consumption? This pipe should provide you with information about your workspace build minutes usage.

As for the issue, I believe the parameter should be URL-encoded to use special characters, please find the following example:

https://api.bitbucket.org/2.0/repositories/<workspace>/<repository>/pipelines?q=created_on%20%3E%3D%202025-01-01T00%3A00%3A00%20AND%20created_on%20%3C%202025-02-01T00%3A00%3A00&fields=values.build_seconds_used,values.created_on,values.completed_on,values.run_creation_date,next,size&sort=-created_on

 I hope this helps.

Regards,
Syahrul

Radu Cristescu February 12, 2025

Thanks for telling me about the Build statistic pipe. I didn't know it existed. In all my searching, that one didn't show up in any results. It may be exactly what I want (or close enough).

Like Syahrul likes this

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
PREMIUM
TAGS
AUG Leaders

Atlassian Community Events