URL
POST https://{api-url}/api/v2/tenants/{tenantId}/policies/management
Sample URLs
https://{api-url}/api/v2/tenants/client_93/policies/management
Parameters
All fields are mandatory:
Field | Description |
---|---|
name | Name of the policy. |
resourceType | Type of resource. Example: DEVICE, VOLUME, VPN, XENSERVER |
matchType | Values: ANY or ALL:
|
rules | Select at least one rule. Rule examples: "key": "Name", "operator": "Contains", and "value": "gateway" .Operator Values: Contains, Not Contains, Equals, Not Equals, Starts with, Ends with, Regex, Is([TRUE, FALSE] |
action | Refers to the actions performed on the filtered resources. Select at least one of the following actions:
Examples: "ASSIGN MONITORINGTEMPLATE" and "ASSIGN KNOWLEDGEARTICLE" |
Note
The attributeforceAssignOrUnassign
is not applicable to the ASSIGN AVAILABILITY action.Sample 1: Assign all actions
Sample 1 request
[{
"name": "all actions",
"matchType": "ALL",
"rules": [
{
"id": 182208,
"key": "Name",
"operator": "Contains",
"value": "test",
"resourceType": "DEVICE",
"isNativeAttribute": true
}
],
"actions": [
{
"action": "ASSIGN MONITORINGTEMPLATE",
"items": [
{
"item": "4053",
"parameters": {
"Packet Count": "3",
"Packet interval": "1000",
"Data Bytes": "64"
},
"instances": {
}
}
],
"forceAssignOrUnassign": false
},
{
"action": "ASSIGN KNOWLEDGEARTICLE",
"items": [
{
"item": "7188"
}
],
"forceAssignOrUnassign": true
},
{
"action": "Assign Jobs",
"items": [
{
"item": "asset info",
"itemType": "assetinfo",
"itemUid": "c072cd67-779a-4206-a3d9-7c761fd563d8"
}
],
"forceAssignOrUnassign": true
},
{
"action": "Assign Availability Rule",
"items": [
{
"item": "AND"
}
]
},
{
"action": "ASSIGN CREDENTIALSET",
"items": [
{
"item": "36218"
}
],
"forceAssignOrUnassign": true
},
{
"action": "ASSIGN CUSTOMATTRIBUTES",
"items": [
{
"item": "264313"
}
],
"forceAssignOrUnassign": true
}
]
}]
Sample 1 response
[
{
"id": 85908,
"uid": "POLICY-4eb7d892-91dc-4ba9-bc92-980effbea64f",
"name": "all actions",
"matchType": "ALL",
"rules": [
{
"id": 182208,
"key": "Name",
"operator": "Contains",
"value": "test",
"resourceType": "DEVICE",
"isNativeAttribute": true
}
],
"actions": [
{
"action": "ASSIGN MONITORINGTEMPLATE",
"items": [
{
"item": "4053",
"parameters": {
"Packet Count": "3",
"Packet interval": "1000",
"Data Bytes": "64"
},
"instances": {
}
}
],
"forceAssignOrUnassign": false
},
{
"action": "ASSIGN KNOWLEDGEARTICLE",
"items": [
{
"item": "7188"
}
],
"forceAssignOrUnassign": true
},
{
"action": "Assign Jobs",
"items": [
{
"item": "asset info",
"itemType": "assetinfo",
"itemUid": "c072cd67-779a-4206-a3d9-7c761fd563d8"
}
],
"forceAssignOrUnassign": true
},
{
"action": "Assign Availability Rule",
"items": [
{
"item": "AND"
}
]
},
{
"action": "ASSIGN CREDENTIALSET",
"items": [
{
"item": "36218"
}
],
"forceAssignOrUnassign": true
},
{
"action": "ASSIGN CUSTOMATTRIBUTES",
"items": [
{
"item": "264313"
}
],
"forceAssignOrUnassign": true
}
]
}
]
Sample 2: Assign Knowledge base article with unique ID
Sample 2 request
[
{
"name" : "TestArticle",
"matchType" : "ALL",
"rules" : [
{
"key" : "Name",
"operator" : "Contains",
"value" : "desktop",
"resourceType": "DEVICE",
"isNativeAttribute": true
}
],
"actions": [
{
"action": "ASSIGN KNOWLEDGEARTICLE",
"items": [
{
"item": "KB0000000123"
}
],
"forceAssignOrUnassign": true
}
]
}
]
Sample 2 response
[
{
"id": 9,
"uid": "POLICY-ef02531c-b090-4535-8e83-968f00787fa6",
"name": "TestArticle",
"matchType": "ALL",
"rules": [
{
"id": 16,
"key": "Name",
"operator": "Contains",
"value": "desktop",
"resourceType": "DEVICE",
"isNativeAttribute": true
}
],
"actions": [
{
"action": "ASSIGN KNOWLEDGEARTICLE",
"items": [
{
"item": "KB0000000123"
}
],
"forceAssignOrUnassign": true
}
]
}
]