MicrosoftDocs / vsts-rest-api-specs

MIT License
164 stars 116 forks source link

Approvals and checks api - List approvals #557

Open safari137 opened 2 years ago

safari137 commented 2 years ago

From this documentation: https://docs.microsoft.com/en-us/rest/api/azure/devops/approvalsandchecks/approvals/query?view=azure-devops-rest-7.1

Is it possible to list all approvals? It looks like you can only query/filter on approvalIds. How do you find those Ids?


Document Details

Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

kamalhabieb commented 1 year ago

Hey @safari137 ,Do you think using this will be helpful for you? https://learn.microsoft.com/en-us/rest/api/azure/devops/approvalsandchecks/approvals/query?view=azure-devops-rest-7.1&tabs=HTTP

safari137 commented 1 year ago

the following sample from that url: GET https://dev.azure.com/{organization}/{project}/_apis/pipelines/approvals?api-version=7.1-preview.1

results in this error response: {"$id":"1","innerException":null,"message":"Query for approvals failed. A minimum of one query parameter is required.\r\nParameter name: queryParameters","typeName":"System.ArgumentException, mscorlib","typeKey":"ArgumentException","errorCode":0,"eventId":0}

this is the url I'm using with a fake organization and project name https://dev.azure.com/my-org/my-proj/_apis/pipelines/approvals?api-version=7.1-preview.1

jsmontoya9207 commented 1 year ago

Do we have any update on this? I'm still needing it :)

diegocsilva commented 1 year ago

I am looking forward to this implementation, it will be very useful since the control of pipeline approvals today is a bit chaotic and this will help us to implement a control or even a plugin for azure

cveld commented 1 year ago

I believe you need to query a checks object first in order to get the related approvals. In the checks result you will find approval objects with guids. That can be probably be used somehow. But when I query for these guids I get an exception back. I will share my findings when I have any success.

// edit: Sorry for the confusion. I am only looking for the approval configuration on the checks itself. Not on the actual approvals given. My query was: e.g. /_apis/pipelines/checks/configurations/3?$expand=settings. The trick was to expand the settings property.