I want to be able to get information about the latest pipeline builds using the Azure DevOps REST API. I'm using Azure DevOps Server 2020 with the January 12 update.
This is the API endpoint I'm using: https://[organization url]/[project name]/_apis/build/latest/succeeded?api-version=6.0-preview.1
I get this error after making the GET request:
{"$id":"1","innerException":null,"message":"Build pipeline succeeded was not
| found.","typeName":"Microsoft.TeamFoundation.Build.WebApi.DefinitionNotFoundException,
| Microsoft.TeamFoundation.Build2.WebApi","typeKey":"DefinitionNotFoundException","errorCode":0,"eventId":3000}
I've also tried these variations of the API endpoint:
https://[organization url]/[project name]/_apis/build/latest/BuildResult?api-version=6.0-preview.1
https://[organization url]/[project name]/_apis/build/latest/BuildResult=succeeded?api-version=6.0-preview.1
I end up getting the same type of error. I know the base API url works because I'm able to get a valid response back using the Get Commits endpoint.
How do I get the url to work?
UPDATE: Using @GChamon answer as a guide I got the latest successful builds.
This is the url that worked for me:
http://[organization url]/[project name]/_apis/build/builds?resultFilter=succeeded&api-version=6.0
Interestingly when I tried to only use `.../build/builds' without any optional parameters it didn't return any results. When I added an optional parameter like resultFilter or statusFilter, it returned results.