Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get pipeline run detail from specific branch in ymal

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.

like image 321
Gaurav Joshi Avatar asked Nov 20 '25 04:11

Gaurav Joshi


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

like image 50
Vito Liu Avatar answered Nov 22 '25 05:11

Vito Liu



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!