3

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'
Wai Ha Lee
  • 8,598
  • 83
  • 57
  • 92
Zorthgo
  • 2,857
  • 6
  • 25
  • 37

2 Answers2

3

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
Wai Ha Lee
  • 8,598
  • 83
  • 57
  • 92
Zorthgo
  • 2,857
  • 6
  • 25
  • 37
0

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

imps
  • 1,423
  • 16
  • 22
  • I tried running the query that you provided, but it is still not returning any pre-release packages. – Zorthgo Mar 07 '19 at 18:46
  • The query I provide had IsPrerelease=false. My bad I've fixed it. Can you try again. – imps Mar 08 '19 at 00:37