Missed Team ’24? Catch up on announcements here.

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

[pipelines API] how to get last pipeline?

Cyril Auburtin August 3, 2018

```

curl -u $BB_TOKEN https://api.bitbucket.org/2.0/repositories/comp/projname/pipelines/ | jq .values[0]

```

gives the first pipeline commit, I'd like the last one, `jq .values[-1]` will give the last one in the current page, but going to the last page isn't practical

 

Is there a way to sort parameter to sort pipelines descendingly?

 

```

curl -u $BB_TOKEN https://api.bitbucket.org/2.0/repositories/comp/projname/pipelines/?sort=-completed_on
{"error": {"message": "Bad request", "data": {"arguments": {}, "key": "rest-service.rest-service.invalid-sort-attribute"}, "detail": "Invalid sort attribute provided 'completed_on'"}}

```

it's not suuported for /pipelines https://developer.atlassian.com/bitbucket/api/2/reference/meta/filtering#query-sort, it would be very useful to do so, or sort DESC by default

 

Gitlab in comparison sort descendingly https://gitlab.com/gitlab-org/gitlab-ce/issues/32466#note_29989146

 

added a ticket: https://jira.atlassian.com/browse/BSERV-11032

1 answer

1 accepted

0 votes
Answer accepted
Philip Hodder
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
August 9, 2018

Hi Cyril

Try this instead:

curl -u $BB_TOKEN https://api.bitbucket.org/2.0/repositories/comp/projname/pipelines/?sort=-created_on

Thanks,

Phil

Sayand Sathish August 30, 2023

For anyone that missed it, the key point here is the `-` in front of the `created_on`.

Here's the documentation for this

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events