2
votes

Source Providers - List Branches:

https://docs.microsoft.com/en-us/rest/api/azure/devops/build/source%20providers/list%20branches?view=azure-devops-rest-5.0

"GET https://dev.azure.com/{organization}/{project}/_apis/sourceProviders/{providerName}/branches?api-version=5.0-preview.1"

Can anyone tell me what the "providerName" string is for?

1

1 Answers

2
votes

It's for the name of the source provider. If you're using TFVC or Azure Devops-native Git, you don't need to use this API -- there are TFVC and Git specific APIs.

If you're using an external Git provider such as GitHub or BitBucket, this is the right place to be. You need to tell the API which external provider you're trying to query.

This is why there is a page listed directly above the "List Branches" entry for a "List" API -- it lists the available source providers for your account.

GET https://dev.azure.com/{organization}/{project}/_apis/sourceproviders?api-version=5.0-preview.1

Calling that API should return something like:

{
  "count": 7,
  "value": [
    {
      "name": "GitHubEnterprise",
      "supportedTriggers": [
        {
          "type": "continuousIntegration",
          "notificationType": "webhook",
          "defaultPollingInterval": 0,
          "supportedCapabilities": {
            "branchFilters": "required",
            "pathFilters": "supported",
            "batchChanges": "supported",
            "buildForks": "unsupported"
          }
        },
        {
          "type": "pullRequest",
          "notificationType": "webhook",
          "defaultPollingInterval": 0,
          "supportedCapabilities": {
            "branchFilters": "required",
            "pathFilters": "supported",
            "batchChanges": "unsupported",
            "buildForks": "supported"
          }
        },
        {
          "type": "schedule",
          "notificationType": "none",
          "defaultPollingInterval": 0,
          "supportedCapabilities": {
            "branchFilters": "required",
            "pathFilters": "unsupported",
            "batchChanges": "unsupported",
            "buildForks": "unsupported"
          }
        }
      ],
      "supportedCapabilities": {
        "createLabel": true,
        "discoverExistingYamlDefinitions": false,
        "queryBranches": true,
        "queryFileContents": true,
        "queryPathContents": true,
        "queryPullRequest": false,
        "queryRelatedWorkItems": false,
        "queryRepositories": true,
        "queryTopRepositories": false,
        "queryWebhooks": true,
        "sourceLinks": true,
        "yamlDefinition": true
      }
    },
    {
      "name": "Svn",
      "supportedTriggers": [
        {
          "type": "continuousIntegration",
          "notificationType": "polling",
          "defaultPollingInterval": 180,
          "supportedCapabilities": {
            "branchFilters": "unsupported",
            "pathFilters": "required",
            "batchChanges": "supported",
            "buildForks": "unsupported"
          }
        },
        {
          "type": "schedule",
          "notificationType": "none",
          "defaultPollingInterval": 0,
          "supportedCapabilities": {
            "branchFilters": "unsupported",
            "pathFilters": "unsupported",
            "batchChanges": "unsupported",
            "buildForks": "unsupported"
          }
        }
      ],
      "supportedCapabilities": {
        "createLabel": false,
        "discoverExistingYamlDefinitions": false,
        "queryBranches": false,
        "queryFileContents": false,
        "queryPathContents": false,
        "queryPullRequest": false,
        "queryRelatedWorkItems": false,
        "queryRepositories": false,
        "queryTopRepositories": false,
        "queryWebhooks": false,
        "sourceLinks": false,
        "yamlDefinition": false
      }
    },
    {
      "name": "GitHub",
      "supportedTriggers": [
        {
          "type": "continuousIntegration",
          "notificationType": "webhook",
          "defaultPollingInterval": 0,
          "supportedCapabilities": {
            "branchFilters": "required",
            "pathFilters": "supported",
            "batchChanges": "supported",
            "buildForks": "unsupported"
          }
        },
        {
          "type": "pullRequest",
          "notificationType": "webhook",
          "defaultPollingInterval": 0,
          "supportedCapabilities": {
            "branchFilters": "required",
            "pathFilters": "supported",
            "batchChanges": "unsupported",
            "buildForks": "supported"
          }
        },
        {
          "type": "schedule",
          "notificationType": "none",
          "defaultPollingInterval": 0,
          "supportedCapabilities": {
            "branchFilters": "required",
            "pathFilters": "unsupported",
            "batchChanges": "unsupported",
            "buildForks": "unsupported"
          }
        }
      ],
      "supportedCapabilities": {
        "createLabel": true,
        "discoverExistingYamlDefinitions": false,
        "queryBranches": true,
        "queryFileContents": true,
        "queryPathContents": true,
        "queryPullRequest": true,
        "queryRelatedWorkItems": true,
        "queryRepositories": true,
        "queryTopRepositories": true,
        "queryWebhooks": true,
        "sourceLinks": true,
        "yamlDefinition": true
      }
    },
    {
      "name": "Bitbucket",
      "supportedTriggers": [
        {
          "type": "continuousIntegration",
          "notificationType": "webhook",
          "defaultPollingInterval": 0,
          "supportedCapabilities": {
            "branchFilters": "required",
            "pathFilters": "unsupported",
            "batchChanges": "supported",
            "buildForks": "unsupported"
          }
        },
        {
          "type": "pullRequest",
          "notificationType": "webhook",
          "defaultPollingInterval": 0,
          "supportedCapabilities": {
            "branchFilters": "required",
            "pathFilters": "unsupported",
            "batchChanges": "unsupported",
            "buildForks": "unsupported"
          }
        },
        {
          "type": "schedule",
          "notificationType": "none",
          "defaultPollingInterval": 0,
          "supportedCapabilities": {
            "branchFilters": "required",
            "pathFilters": "unsupported",
            "batchChanges": "unsupported",
            "buildForks": "unsupported"
          }
        }
      ],
      "supportedCapabilities": {
        "createLabel": false,
        "discoverExistingYamlDefinitions": false,
        "queryBranches": true,
        "queryFileContents": false,
        "queryPathContents": false,
        "queryRelatedWorkItems": false,
        "queryPullRequest": false,
        "queryRepositories": true,
        "queryTopRepositories": false,
        "queryWebhooks": false,
        "sourceLinks": true,
        "yamlDefinition": false
      }
    },
    {
      "name": "Git",
      "supportedTriggers": [
        {
          "type": "continuousIntegration",
          "notificationType": "polling",
          "defaultPollingInterval": 180,
          "supportedCapabilities": {
            "branchFilters": "required",
            "pathFilters": "unsupported",
            "batchChanges": "unsupported",
            "buildForks": "unsupported"
          }
        },
        {
          "type": "schedule",
          "notificationType": "none",
          "defaultPollingInterval": 0,
          "supportedCapabilities": {
            "branchFilters": "required",
            "pathFilters": "unsupported",
            "batchChanges": "unsupported",
            "buildForks": "unsupported"
          }
        }
      ],
      "supportedCapabilities": {
        "createLabel": false,
        "discoverExistingYamlDefinitions": false,
        "queryBranches": false,
        "queryFileContents": false,
        "queryPathContents": false,
        "queryPullRequest": false,
        "queryRelatedWorkItems": false,
        "queryRepositories": false,
        "queryTopRepositories": false,
        "queryWebhooks": false,
        "sourceLinks": false,
        "yamlDefinition": false
      }
    },
    {
      "name": "TfsGit",
      "supportedTriggers": [
        {
          "type": "continuousIntegration",
          "notificationType": "none",
          "defaultPollingInterval": 0,
          "supportedCapabilities": {
            "branchFilters": "required",
            "pathFilters": "supported",
            "batchChanges": "supported",
            "buildForks": "unsupported"
          }
        },
        {
          "type": "schedule",
          "notificationType": "none",
          "defaultPollingInterval": 0,
          "supportedCapabilities": {
            "branchFilters": "required",
            "pathFilters": "supported",
            "batchChanges": "unsupported",
            "buildForks": "unsupported"
          }
        }
      ],
      "supportedCapabilities": {
        "createLabel": true,
        "discoverExistingYamlDefinitions": false,
        "queryBranches": false,
        "queryFileContents": true,
        "queryPathContents": true,
        "queryPullRequest": true,
        "queryRelatedWorkItems": true,
        "queryRepositories": false,
        "queryTopRepositories": false,
        "queryWebhooks": false,
        "sourceLinks": true,
        "yamlDefinition": true
      }
    },
    {
      "name": "TfsVersionControl",
      "supportedTriggers": [
        {
          "type": "continuousIntegration",
          "notificationType": "none",
          "defaultPollingInterval": 0,
          "supportedCapabilities": {
            "branchFilters": "unsupported",
            "pathFilters": "required",
            "batchChanges": "supported",
            "buildForks": "unsupported"
          }
        },
        {
          "type": "gatedCheckIn",
          "notificationType": "none",
          "defaultPollingInterval": 0,
          "supportedCapabilities": {
            "branchFilters": "unsupported",
            "pathFilters": "required",
            "batchChanges": "unsupported",
            "buildForks": "unsupported"
          }
        },
        {
          "type": "schedule",
          "notificationType": "none",
          "defaultPollingInterval": 0,
          "supportedCapabilities": {
            "branchFilters": "unsupported",
            "pathFilters": "unsupported",
            "batchChanges": "unsupported",
            "buildForks": "unsupported"
          }
        }
      ],
      "supportedCapabilities": {
        "createLabel": true,
        "discoverExistingYamlDefinitions": false,
        "queryBranches": false,
        "queryFileContents": true,
        "queryPathContents": true,
        "queryPullRequest": false,
        "queryRelatedWorkItems": true,
        "queryRepositories": false,
        "queryTopRepositories": false,
        "queryWebhooks": false,
        "sourceLinks": false,
        "yamlDefinition": false
      }
    }
  ]
}