Reputation: 12444
I'm using Azure's Runs API to get a pipeline run result as described here:
I can see in the documentation how to get the state and final result so I can know if the run was a success or a failure. However, in case of a failure, I don't see how I can get the error that occurred in that run as a string.
How can I get the actual error which caused the pipeline run to fail?
Upvotes: 1
Views: 1594
Reputation: 13944
You can use the REST API "Timeline - Get" to list the issues (error and warning) associated with a run.
Note: This API can only list the first 10 issues. If the run has more than 10 issues, the rest will not be listed in the response. To get the complete issues, you can use the API "Builds - Get Build Log" or "Logs - Get" to get the complete logs that contains the complete issues.
[UPDATE]
The buildId
is same as the runId
, and you can find it from the URL of the pipeline (build) run.
The timelineId
is not required in the API request, you can use the request URI like as below.
GET https://dev.azure.com/{organization}/{project}/_apis/build/builds/{buildId}/timeline/?api-version=6.0
Upvotes: 2