Azure rest API(6.0-preview.1)运行管道通过邮递员返回:“值不能为空。\ r \ n参数名称:runParameters”

时间:2020-09-03 09:16:07

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

我首先尝试通过邮递员调用rest API来使天蓝色,我调用get pipes 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
}

1 个答案:

答案 0 :(得分:5)

您可以尝试体内的以下内容:

{
    "resources": {
        "repositories": {
            "self": {
                "refName": "refs/heads/branchname"
            }
        }
    }
}

enter image description here