Api/packages?filter

I see that the Packages endpoint of the REST API supports filtering, but what swagger doesn’t specify is which fields it filters on. Can I get some clarity on that?

I would love to be able to filter on the version number less than a given version.

Hi @keithhigbee

Thanks for reaching out! If you browse [YourOctopusUrl]/api you’ll see all the filters available for all the endpoints. In the case of Packages it looks like this:

"Packages": "/api/Spaces-1/packages{/id}{?nuGetPackageId,filter,latest,skip,take,includeNotes}"

Hope that helps!
Dalmiro

You didn’t answer the question. What does ‘filter’ actually filter on? Which fields is it looking at?

Does it respect Nuget version ranges as described here?

Hi Keith,

Apologies for the confusion here, it doesn’t help things that we have a filter named filter :slight_smile:

It is matching on the package name field so is going to return fairly similar results to the ‘nuGetPackageId’ filter.

If you’re wanting to perform more in-depth filtering on the API then your best bet is to use the octopus.client to create a script to retrieve the desired information.

We have a repository of sample scripts to help get you started here: https://github.com/OctopusDeploy/OctopusDeploy-Api/tree/master/Octopus.Client

I hope this helps, please let me know if you have any further questions.

Best regards,
Paul

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.