You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Azure DevOps Server 2022环境审批REST API调用异常问题

Azure DevOps Server 2022调用审批记录API报错:需要至少一个查询参数

我尝试用Postman调用以下REST API列出审批记录:

GET https://{instance}/{collection}/{project}/_apis/pipelines/approvals?api-version=7.0-preview.1

该请求在Azure DevOps Services 7.1环境中能正常返回结果,但在Azure DevOps Server 2022实例中调用失败,收到的错误信息如下:

{
"$id": "1",
"innerException": null,
"message": "Query for approvals failed. A minimum of one query parameter is required.\r\nParameter name: queryParameters",
"typeName": "System.ArgumentException, mscorlib",
"typeKey": "ArgumentException",
"errorCode": 0,
"eventId": 0
}

原因分析

Azure DevOps Server 2022对该API的参数校验比Azure DevOps Services更严格,必须指定至少一个查询参数才能发起请求,而Services端允许无参数查询所有审批记录。

解决方法

你可以添加以下任意一种(或多种)查询参数满足API的要求:

  • statusFilter:按审批状态过滤,可选值如Pending、Approved、Rejected、Canceled
  • assignmentFilter:按分配对象过滤,可选值如Me、All
  • pipelineId:按流水线ID精准过滤
  • releaseId:按发布ID精准过滤

完整请求示例

查询当前用户待处理的审批记录:

GET https://{instance}/{collection}/{project}/_apis/pipelines/approvals?api-version=7.0-preview.1&assignmentFilter=Me

查询所有待审批状态的记录:

GET https://{instance}/{collection}/{project}/_apis/pipelines/approvals?api-version=7.0-preview.1&statusFilter=Pending

内容的提问来源于stack exchange,提问作者osim_ans

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.01 07:53:14