2016-01-23 62 views
8

我有兴趣以非.NET语言编写NuGet v3 API的客户端库。我在哪里可以找到能够告诉我的文档/资源请求提供哪些网址以及回复哪些回复?我在哪里可以找到NuGet v3 API的文档?

我试着做一个快速的谷歌搜索,但唯一出现的是this,这是最近3年前更新的。规范是否存在?

+0

搜索off-site链接显然是题外话,但是当你发现信息考虑更新标签的维基(http://stackoverflow.com/tags/nuget/info) –

+0

很可能你唯一的希望就是C#代码,https://github.com/NuGet/NuGet.Client/tree/dev/src/NuGet.Core/NuGet.Protocol.Core.v3 –

+0

礼貌请求文档https://github.com/NuGet/Home/issues/4062 –

回答

9

Here是官方的NuGet V3 API文档。该API是由多种协议,包括:

  1. Service Index - 使用客户端发现的NuGet服务
  2. Search Service - 客户端使用搜索的NuGet包
  3. Registration - 一个JSON基于-LD的结构存储包的元数据。这包括软件包的内容,相关性,说明等...
  4. "PackageBaseAddress" - 包含实际软件包及其清单文件(nuspec)的存储。

例如,假设你想下载包 “Newtonsoft JSON。”:

  1. 获取服务索引:'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" 
}, 
  1. 使用@id提供的uri作为基本uri列出所需软件包的版本:GET https://api.nuget.org/v3-flatcontainer/newtonsoft.json/index.json,请注意,此uri可能会更改并且不属于API
  2. 使用相同的基础URI下载包:GET https://api.nuget.org/v3-flatcontainer/newtonsoft.json/6.0.4/newtonsoft.json.6.0.4.nupkg

您可能也想看看NuGet client。客户的源代码是 here;你需要从NuGet.CommandLine project开始,然后走下堆栈。

+0

相关问题:https://github.com/NuGet/Home/issues/1870 –

+0

真棒,非常丰富。感谢您的答复! –

3

近日正式V3文档发布here