'nuger.server's FindPackagesById() is not returning pre-release packages

I am trying to query the nuget server using the FindPackagesById() web method. But it is not returning the pre-release versions of the package. I am sure that there's a way to do it. Any help would be appreciated. ;0)

The example below is how I am running the search

http://localhost/nuget/FindPackagesById()?id='NugetTestApp1'


Solution 1:[1]

The problem was that in order for the FindPackagesById() to return pre-release packages we must set the semVerLevel to 2.0.0.

http://localhost/nuget/FindPackagesById()?id='NugetTestApp1'&semVerLevel=2.0.0

Solution 2:[2]

The V2 protocol is not very well documented (the V3 protocol is for example), and that's what the NuGet.Server supports.

However, there is an unofficial docs effort for V2.

Now the support for FindPackagesById may differ from implementation to implementation (for example, NuGet.org does not support the filters). I'd suggest using the packages endpoint as it's a standard OData collection so it's easier to write queries against it.

Example

http://localhost/nuget/Packages()?$filter=Id%20eq%20%27nuget.protocol%27%20and%20IsPrerelease%20eq%20true&$select=Id,Version

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Wai Ha Lee
Solution 2