Sunday 26 August 2018

Values of repositoryType Parameter in VSTS REST API

VSTS REST API is really useful in achieving automations in many aspects of the software development process, and it can be used to write some handy utilities to obtain information quickly with appealing formats. However, sometimes you have to bit struggle to find out which are the correct values to pass for some parameters expected by VSTS REST API, where the documentation does not provide much of a valid information. One such parameter is ‘repositoryType’ in documentation found here for listing build definitions, which does not give any information what are the expected values for the parameter.Documentation here gives some hint on what could be the values but does not have information for REST API expected values.

Trying to find if any build definition exist for a given repo is possible using the REST API by listing build definitions filtered for a given repository ID. But if you do not provide the repository type to the REST API it fails with below shown error message.

Repository type is missing/invalid.image

Here is a table of each repo type and value that is expected by each repo type for parameter ‘repositoryType’ in  VSTS REST API.

Repository‘repositoryType’ Parameter Value
TFVS (Team Foundation Version Control) TfsVersionControl
GitHub GitHub
GitHub Enterprise GitHubEnterprise
Subversion svn
Bitbucket Cloud Bitbucket
External Git Git

No comments:

Popular Posts