You can accomplish many simple tasks using the ePO - On-prem web API. This complete example demonstrates the suggested steps to complete a task.
This example allows you to use the web API to assign a policy to a group.
Use this Help request to find out what the
policy.assignToGroupcommand requires.> curl -k -u ga:ga "https://localhost:8443/remote/core.help?command=policy.assignToGroup"
This command displays:
OK: policy.assignToGroup groupId productId objectId [resetInheritance] Assigns policy to the specified group or resets group's inheritance for the specified policy Requires permission to at least one group in the System Tree and edit permission for at least one product Parameters: groupId (param 1) - Group ID as returned by system.findGroups productId (param 2) - Product ID as returned by policy.find objectId (param 3) - Object ID as returned by policy.find resetInheritance (param 4) - If true resets the inheritance for the specified policy on the given group. Defaults to false.
This Help request shows that there are three required arguments:
Group ID
ID for the product you want to assign
Object ID of the policy to assign.
Note
You could also reset the inheritance, but that argument is not required, and is not used it in this example.
Use the
system.findGroupscommand to find the group ID.> curl -k -u ga:ga "https://localhost:8443/remote/system.findGroups?searchText=My%20Group"
That command returns a result similar to this:
OK: groupId: 2 groupPath: My Organization groupId: 4 groupPath: My Organization\My Group
Use this
policy.findcommand to find the product ID and policy object ID:> curl -k -u ga:ga "https://localhost:8443/remote/policy.find?searchText=quarantine"
That command returns two results:
OK: featureId: VIRUSCAN8800 featureName: VirusScan Enterprise objectId: 131 objectName: McAfee Default objectNotes: productId: VIRUSCAN8800 productName: VirusScan Enterprise 8.8.0 typeId: 67 typeName: Quarantine Manager Policies featureId: VIRUSCAN8800 featureName: VirusScan Enterprise objectId: 142 objectName: My Default objectNotes: productId: VIRUSCAN8800 productName: VirusScan Enterprise 8.8.0 typeId: 67 typeName: Quarantine Manager Policies
Choose one of
policy.findresults. This example uses the My Default policy and you have the necessary information required to assign a policy to a group with this information:Group ID — 4
Product ID — VIRUSCAN8800
Policy object ID — 142
Use the previous information and this
policy.assignToGroupcommand to assign a policy to a group:> curl -k -u ga:ga https://localhost:8443/remote/policy.assignToGroup -d "groupId=4&productId=VIRUSCAN8800&objectId=142"
This returns:
OK: True
The policy is assigned.
RESULT_F67A447F604F438298501DF7A0FE7CF1 In general, the web API commands return three kinds of results:
TrueorFalseresults indicating the command's success or failureData returned from the command
Multiple data items and which items succeeded or failed