Bitbucket API v2 - Get running pipelines only

tech
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!
October 31, 2024

I would like to know if there is a running bitbucket pipeline. To do that, I'm trying to get all pipelines with the status "in progress", using the API.

I found the query to list all pipelines here. And I've found this answer on the forum, using the filtering tools spec here but I can't make it work.

I've tried this very simple query:

curl --request GET \
--url 'https://api.bitbucket.org/2.0/repositories/<myWorkspace>/<myRepository>/pipelines?status!=COMPLETED' \
--header 'Authorization: Bearer <myToken>' \
--header 'Accept: application/json'
But it outputs pipelines in "completed" state:
{
"page": 1,
"values": [
{
"uuid": "{xxxxxxxxxxxxxx}",
"repository": {
...
},
"state": {
"name": "COMPLETED",
...

I've also tried by providing the full path to the "name" property without success.

curl --request GET \
--url 'https://api.bitbucket.org/2.0/repositories/<myWorkspace>/<myRepository>/pipelines?state.name!=COMPLETED' \
--header 'Authorization: Bearer <myToken>' \
--header 'Accept: application/json'

What am I doing wrong?

1 answer

1 accepted

1 vote
Answer accepted
Theodora Boudale
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
November 1, 2024

Hi and welcome to the community!

The not equal operator will not work with the status field. Additionally, COMPLETED is not an available status.

These are the pipelines statuses, as my colleague mentioned in the question you linked:

Successful: status=PASSED,SUCCESSFUL
Failed: status=FAILED,ERROR
Running: PENDING,BUILDING,IN_PROGRESS
Paused: status=PAUSED,HALTED
Stopped: status=STOPPED,SKIPPED

You should be able to get the running pipelines with an API call like the following:

curl -u bitbucket_username:app_password -X GET https://api.bitbucket.org/2.0/repositories/<workspace>/<repository>/pipelines/?status=PENDING&status=BUILDING&status=IN_PROGRESS

Does this work for you?

Filtering by state or state.name is also not supported at the moment:

Kind regards,
Theodora

Suggest an answer

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

Atlassian Community Events