Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v2 Search()? API broken when $filter, $orderby, $skip or $top is missing #7085

Closed
matthid opened this issue Apr 17, 2019 · 6 comments
Closed

Comments

@matthid
Copy link

matthid commented Apr 17, 2019

Previously this function worked. Recently, our tests working with the NuGet gallery started turning red.

While testing around a bit I noticed that the following still works:
www.nuget.org/api/v2/Search()?$filter=IsLatestVersion&$orderby=Id&$skip=0&$top=30&searchTerm='log4net'&targetFramework=''&includePrerelease=false

As soon as you leave out any of $filter, $orderby, $skip, $top or searchTerm you receive:

{
    "statusCode": 404,
    "message": "Resource not found"
}

Therefore the following fails (which is what we have shipped/used in the function above):
www.nuget.org/api/v2/Search()?$filter=IsLatestVersion&searchTerm='log4net'&includePrerelease=false

And the following works again (and could be a workaround or the fix if this break was intended):
www.nuget.org/api/v2/Search()?$filter=IsLatestVersion&$orderby=Id&$skip=0&$top=30&searchTerm='log4net'

@skofman1
Copy link
Contributor

@matthid , we introduced a throttling rule that has a bug. We rolled it back so your scenario should work again.

@skofman1
Copy link
Contributor

@matthid , a question: why do you use V2 API for search? Is there an advantage for using it and not V3 API? Documentation for V3 search is available here: https://docs.microsoft.com/en-gb/nuget/api/search-query-service-resource

A query similar to V2:
www.nuget.org/api/v2/Search()?$filter=IsLatestVersion&searchTerm='log4net'&includePrerelease=false

Will be in V3:
https://api-v2v3search-0.nuget.org/query?q=log4net&prerelease=false

@matthid
Copy link
Author

matthid commented Apr 17, 2019

@matthid , a question: why do you use V2 API for search? Is there an advantage for using it and not V3 API?

Not really. We shouldn't even use the search API for this particular function/use case. It was probably contributed and never modified because it "worked"

Anyway, thanks for the quick fix. Feel free to close.

@loic-sharma
Copy link
Contributor

loic-sharma commented Apr 17, 2019

Not really. We shouldn't even use the search API for this particular function/use case. It was probably contributed and never modified because it "worked"

@matthid, would FAKE be open to move to NuGet's V3 APIs? These APIs scale better and are significantly more performant in countries like China. You can find documentation for the V3 APIs here, but we'd be happy to help the FAKE team with any questions!

@loic-sharma
Copy link
Contributor

Please let us know if you need more info!

@matthid
Copy link
Author

matthid commented Apr 17, 2019

Would FAKE be open to move to NuGet's V3 APIs?

Sure. it boils down to someone tracking all usages and replacing them. I'd accept such PRs.
In this particular instance, I tried myself by using the official NuGet packages: fsprojects/FAKE#2294

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants