1
votes

I query policy configurations over this API: https://docs.microsoft.com/en-us/rest/api/azure/devops/policy/configurations/get?view=azure-devops-rest-5.0

The policy does have required and optional reviewers groups set, but I cannot tell from the response the REST API returned:

{
    "createdBy": {...},
    "createdDate": "2018-11-30T04:35:02.2816989Z",
    "isEnabled": true,
    "isBlocking": true,
    "isDeleted": false,
    "settings": {
        "requiredReviewerIds": "7ca7ce21-a99d-4873-aea7-ba4de2c6fc54",
        "scope": ""
    },
    "_links": {
        "self": "@{href=https://dev.azure.com/myAccount/11111111-2222-3333-4444-555555555555/_apis/policy/configurations/1953}",
        "policyType": "@{href=https://dev.azure.com/myAccount/11111111-2222-3333-4444-555555555555/_apis/policy/types/fd2167ab-b0be-447a-8ec8-39368250530e}"
    },
    "revision": 1,
    "id": 1953,
    "url": "https://dev.azure.com/myAccount/11111111-2222-3333-4444-555555555555/_apis/policy/configurations/1953",
    "type": {
        "id": "fd2167ab-b0be-447a-8ec8-39368250530e",
        "url": "https://dev.azure.com/myAccount/11111111-2222-3333-4444-555555555555/_apis/policy/types/fd2167ab-b0be-447a-8ec8-39368250530e",
        "displayName": "Required reviewers"
    }
},
{
    "createdBy": {...},
    "createdDate": "2019-01-18T09:38:32.9506909Z",
    "isEnabled": true,
    "isBlocking": false,
    "isDeleted": false,
    "settings": {
        "requiredReviewerIds": "0bd7df6e-9f54-408a-bccf-25ace8912acf",
        "scope": ""
    },
    "_links": {
        "self": "@{href=https://dev.azure.com/myAccount/11111111-2222-3333-4444-555555555555/_apis/policy/configurations/2101}",
        "policyType": "@{href=https://dev.azure.com/myAccount/11111111-2222-3333-4444-555555555555/_apis/policy/types/fd2167ab-b0be-447a-8ec8-39368250530e}"
    },
    "revision": 1,
    "id": 2101,
    "url": "https://dev.azure.com/myAccount/11111111-2222-3333-4444-555555555555/_apis/policy/configurations/2101",
    "type": {
        "id": "fd2167ab-b0be-447a-8ec8-39368250530e",
        "url": "https://dev.azure.com/myAccount/11111111-2222-3333-4444-555555555555/_apis/policy/types/fd2167ab-b0be-447a-8ec8-39368250530e",
        "displayName": "Required reviewers"
    }
}

What did I miss?

1
"requiredReviewerIds": "0bd7df6e-9f54-408a-bccf-25ace8912acf", ?4c74356b41
yes, that's the id. but where is the checkbox/flag "optional" which I set in the UI?Kai Walter
that I dont know, sorry ;)4c74356b41

1 Answers

1
votes

isBlocking is the flag that determines whether a policy is optional or not.