【发布时间】:2016-07-19 05:50:24
【问题描述】:
我正在尝试使用 PowerShell 将使用 REST API 和本地 TFS 2015.2 的构建排队。
$body @{ id = 1 }
Invoke-RestMethod -Method Post -Credential "myusername" -ContentType application/json -Uri "https://{tfsurl}/DefaultCollection/Fabrikam-Fiber-Git/_apis/build/builds?api-version=2.0" -Body (ConvertTo-Json $body)
它会抛出一个错误,即它需要 JSON 中的定义。 PowerShell 不喜欢这样,所以我错过了一个简单的语法错误吗?
$body = @{
"definition": {
"id":1
}
}
我看到了这篇文章:How to trigger a build in TFS 2015 using REST API,但我认为它对 PowerShell 方面没有多大帮助。
【问题讨论】:
标签: rest powershell tfs