更新合并请求 azure devOps 的审阅者时出现异常

Getting exception when updating the reviewers of a Pull Request azure devOps

我在 ADO 中有一个有效的拉取请求,想使用此处描述的 API 更新它:

Azure Documentation

至此,我可以成功更新Pull Request的标题了。

{
    "title": "Foo"
}

我现在想更新评论者,这是我正在修补的请求:

{
    "reviewers": [
    {
      "id": "myValidGuid"
    }

   ]
}

但是我收到以下 400 错误返回:

{
"$id": "1",
"innerException": null,
"message": "Invalid argument value.\r\nParameter name: You can only update reviewers, descriptions, titles, merge status, and status.",
"typeName": "Microsoft.TeamFoundation.SourceControl.WebServer.InvalidArgumentValueException, Microsoft.TeamFoundation.SourceControl.WebServer",
"typeKey": "InvalidArgumentValueException",
"errorCode": 0,
"eventId": 0
}

我看不出我的请求有什么问题?

根据您提供的 link,您似乎正在使用 'Pull Requests API',但实际上您应该使用 Pull Request Reviewers API。

根据文档,reviewerID 实际上在 URI 参数中:

PUT https://dev.azure.com/fabrikam/_apis/git/repositories/3411ebc1-d5aa-464f-9615-0b527bc66719/pullRequests/22/reviewers/{reviewerId}?api-version=5.0