Policy Management
    • PDF

    Policy Management

    • PDF

    Article summary

    Profile Policies

    1. Add Policy to a Profile

    This POST method adds a policy to a profile to grant resources to the end user.

    POST{{url}}/api/resource-manager/profiles/{profileId}/policies

    Request Parameters

    The request parameters used in this method are shown in the following table:

    ParameterDescriptionData TypeRequired
    profileIdProfile IDStringMandatory

    Request Example

    curl --location --request POST '{{url}}/api/resource-manager/profiles/{profileId}/policies' \
    --header 'Authorization: TOKEN {{token}}' \
    --data-raw '{
      "id": "string",
      "name": "string",
      "isActive": true,
      "isDraft": true,
      "isReadOnly": true,
      "condition": {},
      "resource": "string",
      "accessLevel": "string",
      "consumer": "string",
    "settings": [
            {
                "settingsType": "ITSM",
                "isInherited": false,
                "connectionId": "71b94622-30ef-4d17-babb-94972ce4b2db",
                "connectionType": "servicenow",
                "isCommentRequired": false,
                "isITSMEnabled": true,
                "itsmFilterCriteria": [
                    {
                        "supportedTicketType": "change_request",
                        "filter": {
                            "sysparm_query": ""
                        }
                    }
                ]
            },
            {
        "settingsType" : "JUSTIFICATION",
        "isJustificationRequired" : true,
        "justificationRegex" : "anand"
      }
        ],
      "members": [
        {
          "id": "string",
          "name": "string",
          "memberType": "User"
        }
      ],
      "resourceLabels": {
        "additionalProp1": [
          "string"
        ],
        "additionalProp2": [
          "string"
        ],
        "additionalProp3": [
          "string"
        ]
      }
    }'

    Response Example 

    Status: 201 Created
    {
      "id": "string",
      "name": "string",
      "isActive": true,
      "isDraft": true,
      "isReadOnly": true,
      "condition": {},
      "resource": "string",
      "accessLevel": "string",
      "consumer": "string",
      "members": [
        {
          "id": "string",
          "name": "string",
          "memberType": "User"
        }
      ],
      "resourceLabels": {
        "additionalProp1": [
          "string"
        ],
        "additionalProp2": [
          "string"
        ],
        "additionalProp3": [
          "string"
        ]
      }
    }

    2. Get All Policies Associated with Profiles

    This GET method is used to get all policies associated with a profile.

    GET{{url}}/api/resource-manager/profiles/{profileId}/policies

    Request Parameters

    The request parameters used in this method are shown in the following table:

    ParameterDescriptionData TypeRequired
    profileIdProfile IDStringMandatory
    filterFilter profiles by key. For example, filter=key eqprofile1StringOptional

    Request Example

    curl --location --request GET '{{url}}/api/resource-manager/profiles/{profileId}/policies' \
    --header 'Authorization: TOKEN {{token}}'

    Response Example 

    Status: 200 OK
    [
      {
        "id": "string",
        "name": "string",
        "isActive": true,
        "isDraft": true,
        "isReadOnly": true,
        "condition": {},
        "resource": "string",
        "accessLevel": "string",
        "consumer": "string",
        "members": [
          {
            "id": "string",
            "name": "string",
            "memberType": "User"
          }
        ],
        "resourceLabels": {
          "additionalProp1": [
            "string"
          ],
          "additionalProp2": [
            "string"
          ],
          "additionalProp3": [
            "string"
          ]
        }
      }
    ]

    3. Get the Policy Details by ID

    This GET method is used to get policy details for a given policy Id.

    GET{{url}}/api/resource-manager/profiles/{profileId}/policies/{policyId}

    Request Parameters

    The request parameters used in this method are shown in the following table:

    ParameterDescriptionData TypeRequired
    profileIdProfile IDStringMandatory
    policyIdPolicy ID to get policy details.StringMandatory

    Request Example

    curl --location -g --request GET '{{url}/api/resource-manager/profiles/{profileId}/policies/{policyId}' \
    --header 'Authorization: TOKEN {{token}}'

    Response Example 

    Status: 200 OK
    
      "id": "string",
      "name": "string",
      "isActive": true,
      "isDraft": true,
      "isReadOnly": true,
      "condition": {},
      "resource": "string",
      "accessLevel": "string",
      "consumer": "string",
      "members": [
        {
          "id": "string",
          "name": "string",
          "memberType": "User"
        }
      ],
      "resourceLabels": {
        "additionalProp1": [
          "string"
        ],
        "additionalProp2": [
          "string"
        ],
        "additionalProp3": [
          "string"
        ]
      }
    }

    4. Update Profile Policy 

    The PATCH method lets you update policy details for a given policy Id.

    PATCH{{url}}/api/resource-manager/profiles/{profileId}/policies/{policyId}

    Request Parameters

    The request parameters used in this method are shown in the following table:

    ParameterDescriptionData TypeRequired
    profileIdProfile IDStringMandatory
    policyIdPolicy ID to update policy details.
    StringMandatory

    Request Example

    curl --location --request PATCH '{{url}}/api/resource-manager/profiles/{profileId}/policies/{policyId}' \
    --header 'Authorization: TOKEN {{token}}' \
    --data-raw '{
      "id": "string",
      "name": "string",
      "isActive": true,
      "isDraft": true,
      "isReadOnly": true,
      "condition": {},
      "resource": "string",
      "accessLevel": "string",
      "consumer": "string",
      "settings": [
            {
                "settingsType": "ITSM",
                "isInherited": false,
                "connectionId": "71b94622-30ef-4d17-babb-94972ce4b2db",
                "connectionType": "servicenow",
                "isCommentRequired": false,
                "isITSMEnabled": true,
                "itsmFilterCriteria": [
                    {
                        "supportedTicketType": "change_request",
                        "filter": {
                            "sysparm_query": ""
                        }
                    }
                ]
            },
            {
        "settingsType" : "JUSTIFICATION",
        "isJustificationRequired" : true,
        "justificationRegex" : "anand"
      }
        ],
      "members": [
        {
          "id": "string",
          "name": "string",
          "memberType": "User"
        }
      ],
      "resourceLabels": {
        "additionalProp1": [
          "string"
        ],
        "additionalProp2": [
          "string"
        ],
        "additionalProp3": [
          "string"
        ]
      }
    }

    Response Example 

    Status: 204 No Content

    5. Delete Profile Policy

    The DELETE method allows you to delete the profile policy created in the system.

    DELETE{{url}}/api/resource-manager/profiles/{profileId}/policies/{policyId}

    Request Parameters

    The request parameters used in this method are shown in the following table:

    ParameterDescriptionData TypeRequired
    profileIdProfile IDStringMandatory
    policyIdPolicy ID to delete policy details
    StringMandatory

    Request Example

    curl --location --request DELETE '{{url}}/api/resource-manager/profiles/{profileId}/policies/{policyId}' \
    --header 'Authorization: TOKEN {{token}}'

    Response Example 

    The profile policy is deleted.

    Status: 204 No Content

    Resource Policy

    1. Add Policy

    This POST method is used to add policy to delegate resource access to users.

    POST{{url}}/api/resource-manager/policies


    Request Example

    curl --location --request POST '{{url}}/api/resource-manager/policies' \
    --header 'Authorization: TOKEN {{token}}'
    --data-raw '
    {
      "id": "string",
      "name": "string",
      "isActive": true,
      "isDraft": true,
      "isReadOnly": true,
      "condition": {},
      "resource": "string",
      "accessLevel": "string",
      "consumer": "string",
      "members": [
        {
          "id": "string",
          "name": "string",
          "memberType": "User"
        }
      ],
      "resourceLabels": {
        "additionalProp1": [
          "string"
        ],
        "additionalProp2": [
          "string"
        ],
        "additionalProp3": [
          "string"
        ]
      } 
    }

    Response Example 

    Status: 201 Created
    {
      "id": "string",
      "name": "string",
      "isActive": true,
      "isDraft": true,
      "isReadOnly": true,
      "condition": {},
      "resource": "string",
      "accessLevel": "string",
      "consumer": "string",
      "members": [
        {
          "id": "string",
          "name": "string",
          "memberType": "User"
        }
      ],
      "resourceLabels": {
        "additionalProp1": [
          "string"
        ],
        "additionalProp2": [
          "string"
        ],
        "additionalProp3": [
          "string"
        ]
      }
    }

    2. Get All Resource Policies

    This GET method is used to get all resource policies.

    GET{{url}}/api/resource-manager/policies?filter=name eq test

    Request Parameters

    The request parameters used in this method are shown in the following table:

    ParameterDescriptionData TypeRequired
    filter
    Parameter to filter policy by name.StringOptional

    Request Example

    curl --location --request GET '{{url}}/api/resource-manager/policies?' \
    --header 'Authorization: TOKEN {{token}}'

    Response Example 

    Status: 200 OK
    [
      {
        "id": "string",
        "name": "string",
        "isActive": true,
        "isDraft": true,
        "isReadOnly": true,
        "condition": {},
        "resource": "string",
        "accessLevel": "string",
        "consumer": "string",
        "members": [
          {
            "id": "string",
            "name": "string",
            "memberType": "User"
          }
        ],
        "resourceLabels": {
          "additionalProp1": [
            "string"
          ],
          "additionalProp2": [
            "string"
          ],
          "additionalProp3": [
            "string"
          ]
        }
      }
    ]

    3. Get Policy Details by PolicyId

    This GET method is used to get policy details for a given policy id.

    GET{{url}}/api/resource-manager/policies/{policyId}

    Request Parameters

    The request parameters used in this method are shown in the following table:

    ParameterDescriptionData TypeRequired
    policyIdProfile policy ID.StringMandatory

    Request Example

    curl --location --request GET '{{url}}/api/resource-manager/policies/{policyId}' \
    --header 'Authorization: TOKEN {{token}}' 

    Response Example 

    Status: 201 OK
    {
      "id": "string",
      "name": "string",
      "isActive": true,
      "isDraft": true,
      "isReadOnly": true,
      "condition": {},
      "resource": "string",
      "accessLevel": "string",
      "consumer": "string",
      "members": [
        {
          "id": "string",
          "name": "string",
          "memberType": "User"
        }
      ],
      "resourceLabels": {
        "additionalProp1": [
          "string"
        ],
        "additionalProp2": [
          "string"
        ],
        "additionalProp3": [
          "string"
        ]
      }
    }

    4. Update Resource Policy Details

    The PATCH method allows you to update resource policy details for a given policy id.

    PATCH{{url}}/api/resource-manager/policies/{policyId}

    Request Parameters

    The request parameters used in this method are shown in the following table:

    ParameterDescriptionData TypeRequired
    policyIdPolicy IDStringMandatory

    Request Example

    curl --location --request PATCH '{{url}}/api/resource-manager/policies/{policyId}' \
    --header 'Authorization: TOKEN {{token}}' \
    --data-raw '{
      "id": "string",
      "name": "string",
      "isActive": true,
      "isDraft": true,
      "isReadOnly": true,
      "condition": {},
      "resource": "string",
      "accessLevel": "string",
      "consumer": "string",
     {
        "id": "b4e1d204-9244-4332-af1e-9465533b09b0",
        "name": "Doc Profile Policy 1",
        "description": "",
        "isActive": true,
        "isDraft": false,
        "isReadOnly": false,
        "settings": [
            {
                "settingsType": "ITSM",
                "id": "",
                "entityId": "b4e1d204-9244-4332-af1e-9465533b09b0",
                "entityType": "POLICY",
                "isInherited": false,
                "connectionId": "71b94622-30ef-4d17-babb-94972ce4b2db",
                "connectionType": "servicenow",
                "isCommentRequired": false,
                "isITSMEnabled": true,
                "itsmFilterCriteria": [
                    {
                        "supportedTicketType": "change_request",
                        "filter": {
                            "sysparm_query": ""
                        }
                    }
                ]
            },
            {
        "settingsType" : "JUSTIFICATION",
        "id" : "4d1bae45-f80e-4f74-97af-083d44b10e21",
        "entityId" : "b4e1d204-9244-4332-af1e-9465533b09b0",
        "isInherited": false,
        "entityType" : "POLICY",
        "isJustificationRequired" : true,
        "justificationRegex" : "xyz"
      }
        ],
        "members": {
            "users": [
                {
                    "id": "0gbxlkyu2bcz4xjfrral",
                    "name": "sangeetab"
                }
            ]
        },
        "consumer": "papservice",
        "accessType": "Allow"
    }
      "members": [
        {
          "id": "string",
          "name": "string",
          "memberType": "User"
        }
      ],
      "resourceLabels": {
        "additionalProp1": [
          "string"
        ],
        "additionalProp2": [
          "string"
        ],
        "additionalProp3": [
          "string"
        ]
      }
    }'

    Response Example 

    Status: 204 No Content

    5. Delete Resource Policy

    This DELETE method is used to delete a resource policy.

    DELETE{{url}}/api/resource-manager/policies/{policyId}

    Request Parameters

    The request parameters used in this method are shown in the following table:

    ParameterDescriptionData TypeRequired
    policyIdProfile policy IDStringMandatory

    Request Example

    curl --location --request DELETE '{{url}}/api/resource-manager/policies/{policyId}' \
    --header 'Authorization: TOKEN {{token}}'

    Response Example 

    Status: 200 OK

    Was this article helpful?