How to determine a package's source repository via API or Client SDK? #11327
-
Hi all, I am attempting to locate the source repository URL of a NuGet package via the API or client SDK. I'd assumed it would be returned with the I've looked around in the client SDK and API and maybe I'm just missing it, but could someone point me to how to find my way to the highlighted link below programmatically? Thanks! |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 3 replies
-
Cross-posted on SO in clase anyone prefers to answer over there: https://stackoverflow.com/questions/69676458/how-can-i-determine-a-nuget-package-source-repository-url-from-the-api-or-client |
Beta Was this translation helpful? Give feedback.
-
Yeah, I was just wondering the difference between "Project Website" and "Source Repository" on nuget.org as well and where that information is coming from. As the NuGet Server API for package metadata only lists Any insight or clarity on the distinction of these two properties and how to retrieve/distinguish them (if possible in the API) would be great to know. Thanks! FYI @nkolev92 is this something you can shed some light on for us? I'm trying to look up package dependencies and query NuGet to see if we can get a link to the GitHub/source for further inquiry/code-analysis; so, distinguishing this data is important for our scenario. Thanks! 🦙❤️ |
Beta Was this translation helpful? Give feedback.
There are a bunch of concepts that are related, but not always equivalent. Nearly all of the metadata nuget.org exposes is read from the nuspec, save for something like owners which is a construct that nuget.org has.
project website
would be something like: https://www.newtonsoft.com/json. Equivalent toprojectUrl
from the nuspec. This is available in the metadata resource.source repository
refers to therepository
metadata in the nuspec, which usually is supposed to refer to the code. https://learn.microsoft.com/en-us/nuget/reference/nuspec#repository. This is not available in the metadata resource: NuGet/NuGetGallery#6262. I think you'd need to use the content resource to download eit…