我在哪里可以找到NuGet v3 API的文档?

时间:2016-01-23 02:19:37

标签: c# .net nuget nuget-package nuget-server

我有兴趣用非.NET语言编写围绕NuGet v3 API的客户端库。我在哪里可以找到关于它的文档/资源,告诉我,例如请求的URL和返回的响应是什么?

我尝试过快速的谷歌搜索,但唯一出现的是this,这是3年前的最后一次更新。规范是否存在?

2 个答案:

答案 0 :(得分:16)

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

  1. Service Index - 客户端用来发现NuGet服务
  2. Search Service - 客户用于搜索NuGet包
  3. Registration - 基于json-LD的结构,用于存储包'元数据。这包括包裹'内容,依赖关系,描述等......
  4. "PackageBaseAddress" - 包含实际包及其清单文件的商店(SET old_passwords = 0;)。
  5. 例如,假设你想下载软件包" Newtonsoft。 JSON":

    1. 获取服务索引:`GET https://api.nuget.org/v3/index.json
    2. 响应包含PackageBaseAddress的地址(也就是说,错误地作为扁平容器,因为它是分层的而不是扁平的:) :):

      nuspec
      1. 使用@id提供的uri作为基础uri列出所需包的版本:{ "@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" }, ,请注意此uri可能会发生变化且不属于API
      2. 使用相同的基本uri下载软件包:GET https://api.nuget.org/v3-flatcontainer/newtonsoft.json/index.json
      3. 您可能还想查看NuGet client。客户端的源代码是  here;你想要从NuGet.CommandLine project开始,沿着堆栈走下去。

答案 1 :(得分:3)

最近发布了官方V3文档here

相关问题