值不能为空。\ r \ n参数名称:inputParameters

时间:2020-10-08 07:34:39

标签: azure azure-pipelines azure-pipelines-release-pipeline azure-devops-rest-api

在尝试使用azure devops REST API创建管道时,我正在获取“值不能为空。\ r \ n参数名称:inputParameters”。 o

任何人都可以建议API调用的请求主体参数是什么。

我的实施:

API CALL (POST) : https://dev.azure.com/{org}/{project}/_apis/pipelines?api-version=6.0-preview.1

请求正文:

{
    "configuration": [
        {
            "type": "yaml",
            "folder": "./",
            "name": "trl-pipeline"
        }
    ]
}

按照https://docs.microsoft.com/en-us/rest/api/azure/devops/pipelines/pipelines/create?view=azure-devops-rest-6.0

响应:

{
    "$id": "1",
    "innerException": null,
    "message": "Value cannot be null.\r\nParameter name: inputParameters",
    "typeName": "System.ArgumentNullException, mscorlib",
    "typeKey": "ArgumentNullException",
    "errorCode": 0,
    "eventId": 0
}

2 个答案:

答案 0 :(得分:1)

请在您的请求正文中添加存储库ID和名称。这是我的示例:

1。我在Azure仓库中创建了一个Yaml文件。

enter image description here

2。我的请求正文如下:

POST https://dev.azure.com/{organization}/{project}/_apis/pipelines?api-version=6.0-preview.1



{
        "configuration":{
            "path": "azure-pipelines.yml",
            "repository":{
                "id": "{repo id}",
                "type": "azureReposGit",
                "name": "{repo name}"
            },
            "type":"yaml"
        },
        "name":"PipelineName"   
    }

答案 1 :(得分:0)

就我而言,发布空白正文有效

POST https://dev.azure.com/{organization}/{project}/_apis/pipelines/{pipelineId}/preview?api-version=6.0-preview

{
}