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{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 answer

  • answered 2021-01-11 07:40 Vito Liu-MSFT

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

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


    GET{Org name}/{Project name}/_apis/build/Builds?branchName=refs%2Fheads%2Ftest&definitions=14


    enter image description here