assignPolicy
Use this method to assign a policy to one or more endpoints. This method works on all endpoint types, including containers. The policy is not assigned to targets that have an enforced policy.
Note
The method uses the default view type. For VMWare integrations it is Hosts and Clusters view. For Citrix XenServer integrations it is Server view. If you are using other views, you must include in targetIds
the IDs of the target endpoints and containers.
Services
This method requires you to place the {service}
name in the API URL. The allowed services are:
computers
, for "Computers and Virtual Machines"virtualmachines
, for "Virtual Machines"
For example, the request URL for the virtual machines
service is:
https://YOUR-HOSTNAME/api/v1.0/jsonrpc/network/virtualmachines
Parameters
Parameter | Description | Included in request | Type | Values |
---|---|---|---|---|
| The IDs of the endpoints you want to assign the policy to. | Mandatory | Array of Strings | No additional requirements. |
| If You can not use this parameter if | Optional | Boolean | Default value: |
| The ID of the policy you want to assign. If not included in the request, the | Optional | String | No additional requirements. |
| If To use this parameter, | Optional | Boolean | Default value: |
Return value
Attribute | Type | Description |
---|---|---|
| Boolean | Indicates if the operation was successful and the policy was successfully assigned to one or more targets. |
Examples
Request
{ "params": { "targetIds": [ "56728d66b1a43de92c7****", "69738d66b1a43de92c71****" ], "inheritFromAbove": false, "policyId": "55828d66b1a43de92c71****", "forcePolicyInheritance": true }, "jsonrpc": "2.0", "method": "assignPolicy", "id": "787b5e36-89a8-4353-88b9-6b7a32e9c87f" }
Response
{ "id": "787b5e36-89a8-4353-88b9-6b7a32e9c87f", "jsonrpc":"2.0", "result": True }