microsoft / azure-devops-dotnet-samples

.NET/C# samples for integrating with Azure DevOps Services and Azure DevOps Server
https://docs.microsoft.com/azure/devops/integrate
MIT License
519 stars 511 forks source link

Pipelines/Checks/Configurations Example #286

Open wjdavis5 opened 4 years ago

wjdavis5 commented 4 years ago

Hello! I'm working on setting up ServiceConnections with this api. You can now setup approvals/checks on Service Connections. I can see the website using _apis/pipelines/checks/configurations/$id but I'm struggling to figure out how to do that with this API.

Are there any examples that I'm missing?

max-morrow-dp commented 3 years ago

Hi @wjdavis5

I was able to get the API request working by issuing a POST against: https://dev.azure.com/{organization}/{project_name}/_apis/pipelines/checks/configurations?api-version=5.2-preview.1

Using Basic authentication, with a Personal Access Token (PAT) as the password.

And the following in the body: { "type": { "id": "8C6F20A7-A545-4486-9777-F762FAFE0D4D", "name": "Approval" }, "settings": { "approvers": [ { "displayName": "[Your Name]", "id": "[Your User Id]", "uniqueName": "[Your Email Address]" } ], "executionOrder": 1, "instructions": "", "blockedApprovers": [], "minRequiredApprovers": 0, "requesterCannotBeApprover": false }, "resource": { "type": "environment", "id": "1", "name": "Test" }, "timeout": 43200 }