Get a specific version of a package from NuGet feed

We have multiple versions of the same package available, for example AppInfra package has version 1.15.x and 1.16.x. During a chain deployment we need to be able to specify the version of the package and right now we get the latest version which is 1.16.x. We have situations where we need to get the latest version within 1.15.x or 1.16.x. How can I do this using your API? Currently the below script results in the last 5 packages and there doesn’t seem to be a way to filter by Major.Minor version before we make the web request.

$geturl = ''
$result = Invoke-WebRequest -Uri $geturl -Headers $reqheaders -UseBasicParsing | ConvertFrom-Json


Hi Karthik,

Thanks for getting in touch, and apologies for the late reply. This one seemed to fall through the cracks!

It is definitely possible to achieve the result that you are after as you can reference a range of versions in your query. I’ve modified your query below which will get you all releases in the 1.15.x range (specifically all releases >= 1.15.0 and < 1.16.0)

$geturl = '[1.15.0,1.16.0)'
$result = Invoke-WebRequest -Uri $geturl -Headers $reqheaders -UseBasicParsing | ConvertFrom-Json

Note the use of mixed [ and ( brackets which defines the search range as per the linked NuGet documentation (specifically under the Version ranges and wildcards heading).

Please let me know if you run into any issues or if there is anything else that we can assist with,