VS402881:未指定与工件源“MyBuild"相对应的工件版本.发布管理 vNext REST API [英] VS402881: No artifact version is specified corresponding to artifact source 'MyBuild.' Release Management vNext REST API

查看:13
本文介绍了VS402881:未指定与工件源“MyBuild"相对应的工件版本.发布管理 vNext REST API的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用的是 TFS 2015.2 RTM,我刚刚发现 Release Management vNext REST API 位于本地 2.2-preview.1.我想创建一个版本,但我不知道要放入 POST 请求正文的确切 JSON,因为 文档 仅适用于 VSTS.

I'm using TFS 2015.2 RTM and I just found out that the Release Management vNext REST API is in 2.2-preview.1 on-premises. I want to create a release, but I don't know the exact JSON to put in the body of the POST request since the documentation only works for VSTS.

当我发送请求时,我收到错误消息:

When I send the request, I get the error message:

VS402881: No artifact version is specified corresponding to artifact source 'MyBuild.' Specify a valid value and try again. 

这是 JSON:

$body = @"
     {
          definitionId": 1,
    "description": "test",
    "artifacts": [ 
      {
         "alias": "Tailspin Toys", 
         "version": {
               "id": 147,
         },
         "instanceReference": {
            "id": 5
        }
       }
     ]
} 
"@

这是 Invoke-RestMethod 命令:

And here's the Invoke-RestMethod command:

$releaseResponse = Invoke-RestMethod -Method Post -Credential $credential -ContentType application/json -Uri $postUri -Body $body

我缺少哪些 JSON 项目?如果文档没有缺少的内容,我如何找到要放入 JSON 正文的内容?

What JSON items am I missing? How do I find what to put in the JSON body if the docs don't have what is missing?

推荐答案

是的,VSTS API 的当前版本与 TFS 2015.2 API 之间存在一些差异.但是除了极少数 API 之外,大多数 API 都应该可以工作.这是文档链接.

Yes there are some disparities between the current version of VSTS APIs and the TFS 2015.2 APIs. But most of the APIs should work except a very few. Here is the documentation link.

以下是创建发布所需的 JSON.所需的 JSON 需要在 instanceReference 中包含 name,尽管它对于当前版本的 VSTS API 是可选的.

Following is the required JSON for creating a release. The required JSON needs to have the name in instanceReference although its optional for the current version of VSTS API.

{
  "definitionId": 1,
  "description": "test",
  "artifacts": [
    {
      "alias": "Tailspin Toys",
      "instanceReference": {
        "id": "5",
        "name": "<build_name>"
      }
    }
  ]
}

这篇关于VS402881:未指定与工件源“MyBuild"相对应的工件版本.发布管理 vNext REST API的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆