Use better API to get version list
praeclarum opened this issue · comments
Frank A. Krueger commented
Just curious, why are you using the package metadata (registration) API to get the list of versions? FYI, you can also get the list of versions using the package content (flat container) API or the autocomplete API:
- Autocomplete - enumerates all LISTED versions
- This is not supported by all package sources (like Sleet)
- Docs: https://docs.microsoft.com/en-us/nuget/api/search-autocomplete-service-resource#enumerate-package-versions
- Example URL: https://azuresearch-usnc.nuget.org/autocomplete?id=mysql.data
- Example client: https://github.com/loic-sharma/BaGet/blob/9c5a9f38896a5b70f6bc66b17c1c94543af39c2a/src/BaGet.Protocol/Search/RawAutocompleteClient.cs#L67
- Package content - enumerates ALL versions
- This works on all V3 package sources
- Docs: https://docs.microsoft.com/en-us/nuget/api/package-base-address-resource#enumerate-package-versions
- Example URL: https://api.nuget.org/v3-flatcontainer/mysql.data/index.json
- Example client: https://github.com/loic-sharma/BaGet/blob/9c5a9f38896a5b70f6bc66b17c1c94543af39c2a/src/BaGet.Protocol/PackageContent/RawPackageContentClient.cs#L33
Originally posted by @loic-sharma in #101 (comment)