通过REST api更新任务组时InvalidRequestException



我正在尝试使用REST api更新我们的本地Azure DevOps 2020服务器上的任务组,但我得到500 InternalServerError

{"$id":"1","innerException":null,"message":"Input TaskGroup parameter cannot be null.","typeName":"Microsoft.TeamFoundation.DistributedTask.Server.Ex
ceptions.InvalidRequestException, Microsoft.TeamFoundation.DistributedTask.Server","typeKey":"InvalidRequestException","errorCode":0,"eventId":3000}

目标是设置visibleRule,这在web界面上是不可能的。

$url = "http://{server}:8080/tfs/{organization}/{project}/_apis/distributedtask/taskgroups?api-version=6.1-preview.1"
$taskGroups = Invoke-RestMethod -Method Get -Uri $url -ContentType 'application/json' -UseDefaultCredentials
$taskGroup = $taskGroups.value | where { $_.name -eq "Deploy Task" }
$input = $taskGroup.inputs | where { $_.name -eq "VersionInternal" }
Add-Member -InputObject $input -MemberType NoteProperty -Name "visibleRule" -Value "1 = 2"
$json = $taskGroup | ConvertTo-Json -Depth 100
$response = Invoke-RestMethod -Method PUT -Uri $url -ContentType 'application/json' -Body $json -UseDefaultCredentials

请求有什么问题?是否有可用的日志文件?或者有其他解决问题的方法吗?

根据我们之前的讨论,也许你的服务器或机器上的某些东西限制了PowerShell更新任务组。

无论如何,邮差可以很好地工作。因此,解决方法是使用Postman调用REST API来更新任务组。

相关内容

  • 没有找到相关文章

最新更新