Mr Nobody
Mr Nobody

Reputation: 396

how to get bitbucket tagged commits sorted by date-wise using Bitbucket API?

I am working on a project that needs to fetch all tagged commits sorted in reverse order by datetime. I first tried using this API /2.0/repositories/{workspace}/{slug}/refs/tags but the results are in random order which i believe is sorted in asc by name.

However I am able to get results in sorted manner by name in desc using /2.0/repositories/{workspace}/{slug}/refs/tags?sort=-name But when I use updated_on , date or datetime I get this error

{
    "type": "error",
    "error": {
        "message": "Invalid field name: date"
    }
}

I can have the expected results by writing some code but can we get same through bitbucket API ?

Upvotes: 0

Views: 2080

Answers (1)

Yuri G.
Yuri G.

Reputation: 4648

Try target.date

/2.0/repositories/{workspace}/{slug}/refs/tags?sort=-target.date

Upvotes: 4

Related Questions