【问题标题】:Getting exception when updating the reviewers of a Pull Request azure devOps更新拉取请求的审阅者时出现异常 azure devOps
【发布时间】:2019-04-08 10:05:11
【问题描述】:

我在 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
}

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

【问题讨论】:

    标签: azure-devops azure-devops-rest-api


    【解决方案1】:

    根据您提供的链接,您似乎正在使用“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
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2022-08-02
      • 1970-01-01
      相关资源
      最近更新 更多