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

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,466,232
Community Members
 
Community Events
176
Community Groups

How to get latest pipelines from API

Edited
Deleted user Jul 04, 2022

I'm trying to get the latest pipelines running on a repo via API, but its only returning the pipelines that were first built.

I know that if I specify the UUID of a specific pipeline, it returns the required info that I'm trying to get, but I'm writing a script and manual UUID assignment is not possible.

Do you guys know what I could do so that I'd get the latest pipelines running?

1 answer

1 accepted

0 votes
Answer accepted
Patrik S Atlassian Team Jul 05, 2022

Hello @[deleted] ,

Welcome to Atlassian Community!

The Bitbucket public API offers sorting/querying capabilities so you can organize the results of the API accordingly to what best fits your use case.

In this case, if you want to order the results returned by the pipeline's endpoint accordingly to created_on date (more recent first), you can use the following example :

curl -X GET -u bitbucket_username:app_password "https://api.bitbucket.org/2.0/repositories/<workspace>/<repository>/pipelines/?sort=-created_on"

 This will sort the results based on the field created_on in descending order (because of the hyphen).

You also have the option to combine both querying and sorting, as in the below example :

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

This will query for only the pipelines that are in the status considered "in progress", and sort the results based on created_on date.

The following pipeline statuses are available for querying/filtering : 

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

Hope that helps! Let me know in case you have any further questions.

Kind regards,

Patrik S 

Deleted user Jul 05, 2022

Thank you!

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
TAGS

Atlassian Community Events