Unable to get latest version when using api

i am trying to use the download api to get the latest version of a release but it looks like the artifact that i am getting is the first on the list and not the latest. nexus version is OSS 3.25.1-04 .

curl -v -X GET “[http://localhost/service/rest/v1/search/assets/download?sort=version&repository=maven-releases&group=com.test&name=demo” -H “accept: application/json” -H"Authorization: Basic **********"

according the doc ( Search API) it should retrieve the latest. does anyone encountered the same issue?

You should specify the direction of the sort

hey thanks , but according to the doc it should already retrieve the latest.

You can download the latest version of an asset by using the “sort=version”

anyway i tried many formats [sort=±version , sort=version± , sort=version&direction=desc etc… ] and none of them worked .

do you know what is the correct format ?
thanks in advance !