rest - Azure rest API (6.0-preview.1) Run Pipeline 返回 : "Value cannot be null.\r\nParameter name: runParameters" via postman

标签 rest azure-devops postman azure-pipelines azure-devops-rest-api

我尝试首先通过 postman 调用rest API到azure,我调用get pipelines API来获取管道id
结果是:2
响应 :

{
    "count": 1,
    "value": [
        {
            "_links": {
                "self": {
                    "href": "https://dev.azure.com/xxx/5fcd81ac-534e-xxx/_apis/pipelines/2?revision=3"
                },
                "web": {
                    "href": "https://dev.azure.com/xxx/5fcd81ac-534e-xxx/_build/definition?definitionId=2"
                }
            },
            "url": "https://dev.azure.com/xxx/5fcd81ac-534e-xxx/_apis/pipelines/2?revision=3",
            "id": 2,
            "revision": 3,
            "name": "xxx.ios_build_on_azure",
            "folder": "\\"
        }
    ]
}
好的,假设 id 是 2,因为我只有 1 个管道,我尝试调用运行 API 来启动这个管道,我得到了这个:
enter image description here
{
    "$id": "1",
    "innerException": null,
    "message": "Value cannot be null.\r\nParameter name: runParameters",
    "typeName": "System.ArgumentNullException, mscorlib",
    "typeKey": "ArgumentNullException",
    "errorCode": 0,
    "eventId": 0
}
更新
如果我尝试添加到正文中:
如中所述:
Azure REST API for running builds or pipelines
像这样 :
{
    "resources": {
        "repositories:" {
            "self": {
                "refName": "xxx/ios_build_on_azure"
            }
        }
    }
}
我越来越 :
{
    "$id": "1",
    "innerException": null,
    "message": "TF400898: An Internal Error Occurred. Activity Id: xxxxx-6ff6-4786-bb2e-f12dxxxx.",
    "typeName": "Newtonsoft.Json.JsonReaderException, Newtonsoft.Json",
    "typeKey": "JsonReaderException",
    "errorCode": 0,
    "eventId": 0
}

最佳答案

您可以在正文中尝试以下内容:

{
    "resources": {
        "repositories": {
            "self": {
                "refName": "refs/heads/branchname"
            }
        }
    }
}
enter image description here

关于rest - Azure rest API (6.0-preview.1) Run Pipeline 返回 : "Value cannot be null.\r\nParameter name: runParameters" via postman,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63720492/

相关文章:

java - 如何使用有条件地返回响应的 Spring REST Docs 记录 REST 服务?

rest - Salesforce 和 apache Camel upsert 操作

bash - Azure DevOps 在 bash 任务内生成密码

rest - GET请求在浏览器中有效,但在POSTMAN或SOAPUI中无效

azure - ADAL 身份验证 token 与 Postman token Oauth2 不同

scala - 用于 REST 轮询的 Akka

java - 如何在 Spring 的 Rest 中上传时验证文件类型、大小?

azure - 如何识别两个不同的应用服务

azure - 如何通过 Azure DevOps 在 Dockerfile 中设置环境变量

arrays - Postman 数据数组到 RAW Post Body 中的变量