Policies¶
Data Structures¶
| Attribute | Type | Required | Description |
|---|---|---|---|
| id | string | Read-only, unique policy identifier. | |
| name | string | yes | Unique, case-insensitive policy name. |
| type | string {ml, regexp} | yes | Immutable. Policy type. |
| priority | string {critical, high, medium, low} | yes | Expensive to use. |
| email_send | boolean; default value false |
yes | |
| input_match | boolean; default value false |
yes | |
| snmp_trap | boolean; default value false |
yes | |
| session_pause | boolean; default value false |
yes | |
| session_terminate | boolean; default value false |
yes | |
| user_block | boolean; default value false |
yes | |
| ml_threat_probability | string {avg, max, min} | If type == ml |
|
| ml_threat_threshold | number | If type == ml |
|
| created_at | datetime | Read-only. Timestamp of creation. | |
| modified_at | datetime | Read-only. Timestamp of modification. | |
| removed | boolean | Read-only. |
Request for Retrieving Available Attributes of the PolicyModel
| Method | GET
|
| Path | /api/v2/objspec/policy
|
Note
To check allowed methods, available URL parameters and possible responses please refer to the API Overview section.
The next chapter describes procedures for creating separate requests.
Retrieving Policies List¶
Request
| Method | GET
|
| Path | /api/v2/policy
|
Example Request
Sending GET https://10.0.0.0/api/v2/policy
curl -s -k -X GET -H 'Authorization: sgfeea6jsaz4mum9su8w61877n1g06sk' 'https://10.0.214.98/api/v2/policy'
Response
{
"result": "success",
"policy": [
{
"id": "9124292845052624897",
"name": "PCP",
"type": "regexp",
"priority": "medium",
"email_send": true,
"input_match": false,
"snmp_trap": false,
"session_pause": false,
"session_terminate": false,
"user_block": false,
"created_at": "2024-06-11 22:52:18.44898-07",
"modified_at": "2024-06-11 22:52:18.44898-07"
},
{
"id": "9124292845052624898",
"name": "AI_Policy_1",
"type": "regexp",
"priority": "low",
"email_send": false,
"input_match": false,
"snmp_trap": false,
"session_pause": false,
"session_terminate": false,
"user_block": false,
"created_at": "2024-06-14 15:15:58.534771-07",
"modified_at": "2024-06-14 15:15:58.534771-07"
}
]
}
Retrieving Policy by ID¶
Request
| Method | GET
|
| Path | /api/v2/policy/<id>
|
Example Request
Sending GET https://10.0.0.0/api/v2/policy/9124292845052624897
curl -s -k -X GET -H 'Authorization: sgfeea6jsaz4mum9su8w61877n1g06sk' 'https://10.0.214.98/api/v2/policy/9124292845052624897'
Response
{
"result": "success",
"policy": {
"id": "9124292845052624897",
"name": "PCP",
"type": "regexp",
"priority": "medium",
"email_send": true,
"input_match": false,
"snmp_trap": false,
"session_pause": false,
"session_terminate": false,
"user_block": false,
"created_at": "2024-06-11 22:52:18.44898-07",
"modified_at": "2024-06-11 22:52:18.44898-07"
}
}
Defining Policy¶
Request
| Method | POST
|
| Path | /api/v2/policy
|
| Headers | Content-Type: Application/HTML
|
| Body | PolicyModel
|
Example Request
Sending POST https://10.0.0.0/api/v2/policy
curl -s -k -X POST -H 'Authorization: sgfeea6jsaz4mum9su8w61877n1g06sk' https://10.0.214.98/api/v2/policy -H 'Content-Type: application/json' -d'{"name":"Policy_1","type":"regexp","priority":"medium","email_send":true,"session_pause":true}'
Response
{
"result": "success",
"policy": {
"id": "9124292845052624899"
}
}
Modifying Policy¶
Request
| Method | PATCH
|
| Path | /api/v2/policy/<id>
|
| Headers | Content-Type: Application/HTML
|
| Body | PolicyModel
|
Example Request
Sending PATCH https://10.0.0.0/api/v2/policy/9124292845052624927
curl -s -k -X PATCH -H 'Authorization: sgfeea6jsaz4mum9su8w61877n1g06sk' 'https://10.0.214.98/api/v2/policy/9124292845052624927' -H 'Content-Type: application/json' -d'{"priority":"low","email_send":false,"user_block":true}'
Response
{
"result": "success"
}
Deleting Policy¶
Request
| Method | DELETE
|
| Path | /api/v2/policy/<id>
|
Example Request
Sending DELETE https://10.0.0.0/api/v2/policy/9124292845052624899
curl -s -k -X DELETE -H 'Authorization: sgfeea6jsaz4mum9su8w61877n1g06sk' https://10.0.214.98/api/v2/policy/9124292845052624899
Response
{
"result": "success"
}