Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.1k views
in Technique[技术] by (71.8m points)

json - VS402881: No artifact version is specified corresponding to artifact source 'MyBuild.' Release Management vNext REST API

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. 

Here's the JSON:

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

And here's the Invoke-RestMethod command:

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

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?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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.

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>"
      }
    }
  ]
}

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...