How to get pipeline run detail from specific branch in ymal

Viewed 624

I'm trying to get pipeline run details using definition id using below Rest API

https://dev.azure.com/{organization}/{project}/_apis/pipelines/{definitionId}/runs/?api-version=6.0-preview.1

this is giving me all the details from the specific definition id though I have few local branch off of master for testing purpose. Now when I run this API its gives me all the run details including local branch and master branch.

I want run details only from the master branch I tried using filter like this

&branchName=master or ref=master but it didn't work.

Any help or suggestion would be really helpful.

Thanks in advance.

1 Answers

You need to specify branchName (replace / to %2F). For example (test):

GET https://dev.azure.com/{Org name}/{Project name}/_apis/build/Builds?branchName=refs%2Fheads%2F{branch name}&definitions={Build definition ID}

Sample:

GET https://dev.azure.com/{Org name}/{Project name}/_apis/build/Builds?branchName=refs%2Fheads%2Ftest&definitions=14

Result:

enter image description here

Related