在哪里可以找到 NuGet v3 API 的文档?
Where can I find documentation for the NuGet v3 API?
我有兴趣使用非 .NET 语言围绕 NuGet v3 API 编写客户端库。 URL 请求获取包裹的请求是什么,响应是什么?
即
获取{包版本}
获取 {package-version}
是否有涵盖此场景的官方文档?
Here 是官方 NuGet V3 API 文档。 API由多个协议组成,包括:
- Service Index - 客户端用于发现 NuGet 服务
- Search Service - 客户端用于搜索 NuGet 包
- Registration - 基于 json-LD 的结构,用于存储包的元数据。这包括包的内容、依赖项、描述等...
- "PackageBaseAddress" - 包含实际包及其清单文件的商店(
nuspec
)。
例如,假设您要下载包“Newtonsoft.
Json":
- 获取服务索引:`GET https://api.nuget.org/v3/index.json
响应包含 PackageBaseAddress 的地址(又名,错误地作为扁平容器,因为它是分层的而不是扁平的:)):
{
"@id": "https://api.nuget.org/v3-flatcontainer/",
"@type": "PackageBaseAddress/3.0.0",
"comment": "Base URL of Azure storage where NuGet package registration info for DNX is stored, in the format https://api.nuget.org/v3-flatcontainer/{id-lower}/{version-lower}.{version-lower}.nupkg"
},
- 使用@id 提供的 uri 作为基本 uri 来列出所需包的版本:
GET https://api.nuget.org/v3-flatcontainer/newtonsoft.json/index.json
,请注意,此 uri 可能会更改,并且不是 [=51= 的一部分]
- 使用相同的基本 uri 下载包:
GET https://api.nuget.org/v3-flatcontainer/newtonsoft.json/6.0.4/newtonsoft.json.6.0.4.nupkg
您可能还想看看 NuGet client。客户端的源代码是
here; you'll want to start from the NuGet.CommandLine project 然后沿着堆栈走下去。
我有兴趣使用非 .NET 语言围绕 NuGet v3 API 编写客户端库。 URL 请求获取包裹的请求是什么,响应是什么?
即
获取{包版本} 获取 {package-version}
是否有涵盖此场景的官方文档?
Here 是官方 NuGet V3 API 文档。 API由多个协议组成,包括:
- Service Index - 客户端用于发现 NuGet 服务
- Search Service - 客户端用于搜索 NuGet 包
- Registration - 基于 json-LD 的结构,用于存储包的元数据。这包括包的内容、依赖项、描述等...
- "PackageBaseAddress" - 包含实际包及其清单文件的商店(
nuspec
)。
例如,假设您要下载包“Newtonsoft. Json":
- 获取服务索引:`GET https://api.nuget.org/v3/index.json
响应包含 PackageBaseAddress 的地址(又名,错误地作为扁平容器,因为它是分层的而不是扁平的:)):
{
"@id": "https://api.nuget.org/v3-flatcontainer/",
"@type": "PackageBaseAddress/3.0.0",
"comment": "Base URL of Azure storage where NuGet package registration info for DNX is stored, in the format https://api.nuget.org/v3-flatcontainer/{id-lower}/{version-lower}.{version-lower}.nupkg"
},
- 使用@id 提供的 uri 作为基本 uri 来列出所需包的版本:
GET https://api.nuget.org/v3-flatcontainer/newtonsoft.json/index.json
,请注意,此 uri 可能会更改,并且不是 [=51= 的一部分] - 使用相同的基本 uri 下载包:
GET https://api.nuget.org/v3-flatcontainer/newtonsoft.json/6.0.4/newtonsoft.json.6.0.4.nupkg
您可能还想看看 NuGet client。客户端的源代码是 here; you'll want to start from the NuGet.CommandLine project 然后沿着堆栈走下去。