1
votes

I am getteing "Value cannot be null.\r\nParameter name: inputParameters" while trying to create a pipeline using the azure devops REST APIs. o

Can anybody suggest what should be the request body parameters for the API Call.

My Implemetation:

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

Request Body:

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

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

Response:

{
    "$id": "1",
    "innerException": null,
    "message": "Value cannot be null.\r\nParameter name: inputParameters",
    "typeName": "System.ArgumentNullException, mscorlib",
    "typeKey": "ArgumentNullException",
    "errorCode": 0,
    "eventId": 0
}
2
As I read the documentation, the folder and name fields should go up a level to be siblings of configuration. You could also create a pipeline in the UI then GET that with an http request and see how it is structured, to verify this.Tom W
Thanks @TomW, I am new to this and it helped me to learn where to look in such issues. 👍Abhineet Chaudhary

2 Answers

2
votes

Please add repository id and name in your request body. Here is my sample:

1.I created a yaml file in my azure repos.

enter image description here

2.My request body looks like this:

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"   
    }
0
votes

In my case, posting a blank body worked

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

{
}