Azure Devops rest API for create pipeline with source provider bitbucket not working

Viewed 768

I am new on Azure and trying to create pipeline through rest api with below URL https://dev.azure.com/my-org/my_project/_apis/pipelines?api-version=6.1-preview.1

When Source Provider is Azure Git Repo then it working perfectly fine with below request body

{
  "folder": "\\",
  "name": "Test-Pipeline-1",
  "configuration": {
        "type": "yaml",
        "path":"/azure-pipelines.yml",
        "repository":{
            "id": "1f13f61c-eade-b36bc515bb5e",
             "name": "TestAzure123",
             "type":"azureReposGit"
        }
  }
}

But when Source Provider is Bitbucket Cloud then its not working

{
  "folder": "\\",
  "name": "Bitbucket-Pipeline",
  "configuration": {
        "type": "yaml",
        "path":"/master-pipeline.yaml",
        "repository": {
                "id": "sid_07/Bitbucket-repository",
                "name": "Bitbucket-repository",
                "type": "Bitbucket"
            }
  }
}

I am getting below exception

{
    "$id": "1",
    "innerException": null,
    "message": "This API does not support creating pipelines with repositories of type Unknown.",
    "typeName": "Microsoft.Azure.Pipelines.WebApi.UnsupportedRepositoryTypeException, Microsoft.Azure.Pipelines.WebApi",
    "typeKey": "UnsupportedRepositoryTypeException",
    "errorCode": 0,
    "eventId": 3000
}

Is pipeline creation supported through rest api for bitbucket? or am I missing something? Please help

I have already taken reference from similar issue https://developercommunity.visualstudio.com/content/problem/1101376/create-pipeline-rest-api-does-not-work.html

1 Answers

Azure Devops rest API for create pipeline with source provider bitbucket not working

I am afraid the REST API Pipelines - Create does not support the creation of a pipeline whose source type is bitbucket at this moment.

When I use the request body below, which I used to create a pipeline for the resource type of github:

{
    "folder": "\\",
    "name": "Test-Pipeline-2",
    "configuration": {
        "path": "TestDemo.yml",
        "repository": {
            "fullName": "xxx/leotest",
            "connection": {
                "id": "e11d299a-0bfd-4a38-a77c-xxxxxxxx"
            },
            "type": "bitbucket"
        },
        "type": "yaml"
    }

I got the same error as you:

enter image description here

Then I created that pipeline manually, and use the REST API Pipelines - Get to get the detailed info about this pipeline, I got following info:

"configuration": {
    "path": "BitbucketRepo.yml",
    "repository": null,
    "type": "yaml"
},
"url": "https://dev.azure.com/xxx/xxxxx/_apis/pipelines/146?revision=2",
"id": 146,
"revision": 2,
"name": "BitbucketRepo",
"folder": "\\YAML\\Resources"

We could to know the part of repository: is null.

So, the REST API Pipelines - Create does not support create pipeline with source provider bitbucket at this moment.

For this request, you could add it for this feature on our UserVoice site (https://developercommunity.visualstudio.com/content/idea/post.html?space=21 ), which is our main forum for product suggestions. Thank you for helping us build a better Azure DevOps.

enter image description here

Related