2

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://learn.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. Commented Oct 8, 2020 at 7:38
  • Thanks @TomW, I am new to this and it helped me to learn where to look in such issues. 👍 Commented Oct 8, 2020 at 8:56

2 Answers 2

3

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"   
    }
Sign up to request clarification or add additional context in comments.

1 Comment

@Abhineet Chaudhary I am glad to know that it is useful to you. You could accept it as answer like this.
0

In my case, posting a blank body worked

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

{
}

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.