0

I was trying to create a yml pipeline with Pipeline - Create Azure DevOps REST API and it was throwing an exception 'No pool was specified' even though I have mentioned pool in the yml file. More details of this issue is available here. Please find below, the request body used for creating pipeline.

{
"folder": "",
"name": "pipeline-by-api",
"configuration": {
    "type": "yaml",
    "path": "/azure-pipelines.yml",
    "repository": {
        "id": "00000000-0000-0000-0000-000000000000",
        "name": "repo-by-api",
        "type": "azureReposGit"
    }
}

Then I identified a second REST API, Definitions - Create and using this I was able to successfully create a pipeline. Please find below the request body used for creating build definition.

    {     
     "process":{
       "yamlFilename":  "azure-pipelines.yml"
     },
     "queue":{
       "pool":{
         "name": "Azure Pipelines"
        }
     },
     "repository": {
       "id":  "00000000-0000-0000-0000-000000000000",
       "type":  "TfsGit",
       "name":  "repo-by-api",                       
       "defaultBranch":  "refs/heads/master"
     },  
     "name":  "pipeline-by-api",  
     "path":  "\\API-Test",
     "type":  "build",
     "queueStatus":  "enabled"
    }

I would like to understand what's the difference between the two. I have tried Definitions - Create as Pipelines - Create was not working for me. But is this a correct way of creating pipeline?

Sneha Dominic
  • 368
  • 2
  • 14

1 Answers1

1

Definitions - Create is an older endpoint. It was availabe before YAML pipeline becomes first class citizens. Pipelines - Create is a new endpoint suited for YAML pipelines. Both can be used to create pipeline and if you change API version to 4.1 you will see that Pipelines is not available.

enter image description here

If I have to guess, they find a reason to create a new endpoint for handling yaml pipelines, probably to avoid some breaking changes, but this is only a guess.

Krzysztof Madej
  • 32,704
  • 10
  • 78
  • 107
  • Pipeline - Create only available starting 6.0 onward , and I have same guess as well to avoid breaking changes - you can notice that with `preview` flag with Pipeline - Create but not Definitions - Create – Turbot Aug 13 '21 at 09:33