Update user-defined filter
Updates a specified user-defined filter.
HTTP Request
PUT /api/sonar/user-defined-filters
cURL Example
curl -H "Authorization: Bearer <API_KEY>" \
-H "Content-Type: application/json" \
-d '{
"guid": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"name": "Internal IP filter",
"description": "Updated internal network IP address filter",
"predicate": {
"src_ip": "10.0.0.0/8"
}
}' \
-X PUT \
https://HOSTNAME/api/sonar/user-defined-filters
Request Parameters
| Key | Required | Type | Description | Note |
|---|---|---|---|---|
| guid | Yes | String | User-defined filter GUID | 36 characters |
| name | Yes | String | User-defined filter name | |
| description | No | String | User-defined filter description | |
| predicate | Yes | String key/value map | Filter predicate condition | Expression tree object |
The predicate is a recursive expression tree. Each node contains the following keys:
- type (String, required): Node type. One of
and,or,eq,neq,in,is_null,is_not_null,gt,gte,lt,lte,starts_with,ends_with,contains,value,expr - args (Array): List of child conditions for logical operators such as
andandor. Each item follows the same expression tree structure. - value (String): Comparison value used by
valueandexprtypes - comment (String, optional): Condition description
Success Response
{}
Error Responses
Required argument is missing
HTTP status code 400.
{
"error_code": "null-argument",
"error_msg": "name should be not null"
}
User-defined filter is not found
HTTP status code 500.
{
"error_code": "illegal-state",
"error_msg": "user defined filter not found: a1b2c3d4-e5f6-7890-abcd-ef1234567890"
}
Duplicate filter name
HTTP status code 500.
{
"error_code": "illegal-state",
"error_msg": "duplicated user defined filter name: Internal IP filter"
}
No privilege to manage user-defined filters
HTTP status code 500.
{
"error_code": "illegal-state",
"error_msg": "no-permission"
}