Reputation: 1244
I am unable to get a list of builds when using the devops api (I am requesting it without any additional filters)
https://dev.azure.com/{organization}/{project}/_apis/build/builds?api-version=5.1
It returns the following
{ "value": [ ], "count": 0 }
It seems that the API is working other wise as if the following URL is working and returning a full details about the build
https://dev.azure.com/{organization}/{project}/_apis/build/builds/{buildId}?api-version=5.1
I am using token authentication and all the other tests seem to work as I would expect. All the {variables} are replaced with my queries, but have left them in as that is somewhat sensitiv(e.
Am I missing something? Is the API broken?
Upvotes: 1
Views: 1075
Reputation: 21
This is all about permission to view work items. Check if your PAT has a needed scope to work with work items.
(If you invoke API requests in your build pipelines and you are using system token $(System.AccessToken) for authentication, then you should check if the user "{ProjectName} Build Service ({ProjectCollectionName})" has permission to view work items at the specific area path.) Such permission issue is pretty tricky when you work with multiple projects and your PAT or system token doesn't have access to some of these projects.
Upvotes: 0
Reputation: 76928
AzureDevops API builds list API returns empty json results
As test, the rest api Builds - List works fine:
GET https://dev.azure.com/{organization}/{project}/_apis/build/builds?api-version=5.1
I test it with postman by using the PAT (only have the build read scope of access):
So, the REST API is fine.
Besides, since you could also get the result with a specify a build Id, please confirm if there are any errors in your url and if there are too many pipelines in your project, which has not returned the correct value in time. You could test it with a new test project.
Besides, what Eric said is also a possibility, please make sure the token authentication have permission to read all pipeline, you could create a PAT with build read scope of access.
Hope this helps.
Upvotes: 1