Reputation: 45
A follow up on my previous questions How to use ADO Rest API to get the list of test run in a specific build.
I use Runs - Query api to get runs of my build:
GET https://dev.azure.com/{organization}/{project}/_apis/test/runs?minLastUpdatedDate={minLastUpdatedDate}&maxLastUpdatedDate={maxLastUpdatedDate}&buildIds={buildIds}&api-version=6.0
But I see that the count
value in the JSON body does not match with the # of job I see in the build result page, i.e. https://{my org}.visualstudio.com/{my project}/_build/results?buildId={my build id}&view=results
From the build result page, I only have 5 jobs. Can you please help me in how to get the # of job in the build result page?
Moreover, each job has a log. How to get the log id of each job so that I can use this api https://learn.microsoft.com/en-us/rest/api/azure/devops/build/builds/get%20build%20log?view=azure-devops-rest-6.1
Upvotes: 0
Views: 636
Reputation: 35109
Can you please help me in how to get the # of job in the build result page?
The #number
in the Build Result Page is the Build Number of the Build Pipeline.
To Get this number, you could use the Rest API: Builds - Get
GET https://dev.azure.com/{organization}/{project}/_apis/build/builds/{buildId}?api-version=6.1-preview.6
Then you could Check the buildNumber
field in the Response.
How to get the log id of each job so that I can use this api https://learn.microsoft.com/en-us/rest/api/azure/devops/build/builds/get%20build%20log?view=azure-devops-rest-6.1
To Get the LogId for each job, you need to use this Rest API: Timeline - Get
GET https://dev.azure.com/{organization}/{project}/_apis/build/builds/{buildId}/timeline?api-version=4.1
Note: If you do not enter a specific timelineid, you will get the timeline of the entire build
Then you can find the corresponding logid based on the job name(e.g. Agent Job 1) or identifier Name(e.g. Job_2,Job_1)
Upvotes: 1