REST API - Filter by name comparison with natural sorting

Hi,

I’m trying to create a query on REST API v2 to get a later branch version. My branches are named according to their release versions as expected by the API (v1.8.0, v1.9.0, v1.10.0 etc).

While it is great that adding ?sort=name manages to sort the results numerically and v1.10.0 shows up after v1.9.0, trying to filter on name comparisons like ?q=name > v1.9.0 (imagine this is encoded properly) still only shows results in lexicographic order (i.e. v1.10.0 does not show up with that ?q=name > v1.9.0). Appending &sort=name to this query doesn’t seem to enable natural sorting on the filter either.

Is there some way of enabling filter comparisons with natural sorting?

@RichardLou welcome to the Atlassian developer community.

No. Both Bitbucket and Git only know the names of branches as simple strings. Neither will sort by the semantics of version numbers.

What you might do is grab all the branch names and them use a Semantic Versioning library to sort and filter them on your client side.

Thank you for clarifying.