Search code examples
restazure-devopsrelease-management

VSTS REST API Get ReleaseDefinition by name


How do I get a release definition from the VSTS Rest API by release definition name?

the name query string parameter is ignored when I GET from

https://{instance}vsrm.visualstudio.com/{project}/_apis/release/definitions?api-version=4.0-preview.3&name={definition name}

I need a way to fetch the release when I don't know the release id.


Solution

  • according to the docs you can use the searchText parameter:
    Optional. Get release definitions with names starting with searchText

    I quickly tried and it worked with this query:

    https://{instance}vsrm.visualstudio.com/{project}/_apis/release/definitions?api-version=4.0-preview.3&searchText=definitionName
    

    However if you would have multiple definitions starting with that string you might get back more than one definition.

    Edit: I just saw that on top of that you can specify the isExactNameMatch parameter.
    'true'to gets the release definitions with exact match as specified in searchText. Default is 'false'.