Create¶
POST /api/v1/blacklist/add
Overview¶
Create a blacklist filter rule for the current workspace.
Before You Call and Usage Steps¶
The request uses application/json, and fields are placed in the Body as shown in the JSON example below. The current create Body does not perform complete field validation; callers must check types, lengths, and ranges against the field table. It is recommended to submit a complete set of a non-empty unique name, a supported type, sources, and conditions.
When the creation name is omitted, the system attempts to generate it based on the calling identity, but it may be empty when no identity can be parsed; do not rely on automatic naming. It is recommended that name be within 48 characters. An explicitly null source, an overlong storage field, a non-object JSON top level, or other malformed shapes may result in 500.
Leaf operations: = (is), != (is_not/is not), >/>=/<!--<= use only the first item in value; in and not_in (not in) match sets; match/contain and not_match/not_contain perform contains matching; regexp (re) and not_regexp perform regular expression matching, and the regular expression value is the raw expression; wildcard/not_wildcard use string wildcard values; exist/exists and not_exist/not_exists check whether a field exists. The exist type still requires a non-empty value array to pass the current validation; you can fill in ["ignored"], and that value does not participate in the condition. Do not copy the type=group/rule structure of the log index advancedFilter.
For numeric values, it is recommended to pass JSON numbers directly. The new logic writes parseable numeric strings into the generated conditions only when a source of the same type can confirm that the field is numeric and the operation is comparison/equality/set; the original filters remain unchanged. When the field type is unknown/conflicting, the query fails, or metric does not infer it, the original string is retained; string matching/regular expressions are also not converted. A successful save does not guarantee that unknown fields or non-convertible numeric values can match.
This is a rule configuration operation and does not delete historical data. The API result does not provide the effective progress of downstream pipelines; after changes, verify the actual scope with controlled samples.
The required, maximum length, allow null, and other markers in the parameter table follow historical params declarations and are for compatibility reference only; the current create entry does not perform validation of the corresponding Body fields. Actual input should be based on each field description and storage range.
Request Headers¶
| Parameter Name | Type | Required | Description |
|---|---|---|---|
| DF-API-KEY | string | Y | OpenAPI authentication credential for the workspace.<DF-API-KEY>How to obtain or fill in: Obtain an OpenAPI Key with the required permissions from API Key Management in the target workspace. |
Body Request Parameters¶
| Parameter Name | Type | Required | Description |
|---|---|---|---|
| sources[*] | string | Single source name; do not enter a UUID or regular expression wrapper; use the top-level source for all sources. Example: nginxHow to obtain or fill in: Enter a single actual source name. |
|
| filters[*] | json | A single leaf condition. It is recommended to explicitly provide name/condition/operation/value; array members are not fully validated against the declaration, and malformed shapes may result in 500. Example: {"name": "path", "condition": "and", "operation": "=", "value": ["/healthz"]}How to obtain or fill in: Construct it based on actual data fields, matching operations, and actual values. |
|
| filters[*].name | string | Required non-empty field name; names containing backticks will be rejected. Saving does not guarantee that the field is validated as existing; verify the data. Example: pathHow to obtain or fill in: Obtain the actual field name from the data details or field list for the corresponding type; display aliases cannot be used. |
|
| filters[*].condition | string | Only and/or are recommended; the connector of the first condition is ignored. The current lenient validation does not guarantee that all invalid logic is rejected; clients should enforce their own constraints. Example: andHow to obtain or fill in: If the previous condition at the same level has an AND relationship, enter and; if any relationship applies, enter or. |
|
| filters[*].operation | string | Explicitly specify the operator string; for the compatible field op, see the supplement. See the description for the value semantics of different operators. Example: =How to obtain or fill in: Choose from the operator descriptions on this page, such as =, in, match, regexp, and exist. |
|
| filters[*].op | string | Legacy alias for operation; if both are provided, operation takes precedence; using operation consistently is recommended. Example: =How to obtain or fill in: op can be used when compatible with historical condition structures. |
|
| filters[*].value | JSON | A non-empty array is recommended. =, !=, comparison, regexp/wildcard, and others are handled according to each operator's rules; = and comparisons use only the first value, while in/match support multiple values. Do not use null or an empty array. Example: ["/healthz"]How to obtain or fill in: Fill in actual field values; for numeric conditions, JSON numbers are recommended, and strings are used for text. |
|
| filters[*].value[*] | string or number | A single condition value. Do not write unverified unit conversions; "0" may be converted to 0 when the numeric type is confirmed, while the saved filters still retain the original input. Example: /healthzHow to obtain or fill in: Take the actual field value; use the numeric type for numeric fields, with units consistent with the original field. |
|
| filters[*].filters | array | Optional nested group that recursively uses the same structure; the current check_filters also requires groups to have non-empty name/condition/value, and common groups with only condition+filters may return 406. For normal calls, prefer flattening leaf conditions; for complex groups, validate before saving. Example: [{"name": "env", "condition": "and", "operation": "=", "value": ["production"]}]How to obtain or fill in: For nested conditions, preferably obtain them from a verified console configuration or an existing export. |
|
| name | string | Y | The create endpoint does not perform complete Body declaration validation; it is recommended to explicitly provide a non-empty value of ≤48 characters to match the storage column. Names of non-deleted rules in the same workspace must be unique; disabled rules also occupy the name. The value 50 in the table is a historical declaration reference, not a mandatory upper limit for this create Body; for storage compatibility, ≤48 is still recommended. Allow null: False Allow empty string: False Maximum length: 50 Example: 忽略健康检查日志How to obtain or fill in: Name it according to your business; first check whether a rule with the same name already exists in the workspace from the blacklist list. |
| desc | string | Optional description; the create endpoint has no complete Body length validation; ≤512 characters is recommended to match the storage column, and an empty string is used when omitted. The value 256 in the table is a historical declaration reference, not a mandatory upper limit for this create Body; for storage compatibility, ≤512 is recommended. Allow null: False Allow empty string: True Maximum length: 256 Example: 过滤生产nginx健康检查请求。How to obtain or fill in: Describe the rule's purpose and expected impact. |
|
| type | string | Y | Data category, not rule status. The mapping determines the meaning of source; unsupported types may return DataSourceMismatch, and the declared text is not an enum validation. Allow null: False Example: loggingHow to obtain or fill in: Common categories are logging/object/custom_object/keyevent/tracing/rum/network/security/profiling/metric; the current mapping also recognizes lineage/object_history/billing/dialtest/llm/agent_monitor, which must be supported by the target data pipeline itself. |
| source | string | Single source; use re(.*) for all sources; non-empty sources take precedence. When omitted here, it is an empty string. Do not pass null; verify the actual source.Allow null: True Allow empty string: False $maxCharacterLength: 128 Example: nginxHow to obtain or fill in: Obtain it from the actual data source of the corresponding category; for logging it is source, for object/custom_object it is class, for tracing/profiling it is service, for rum it is app_id, for security it is category, for metric it is measurement, for object_history it is also class, and for the other listed categories it is source. |
|
| sources | array | Array of multiple exact source names; when non-empty, they are combined with IN and take precedence over source; [] falls back to source. When omitted here, it is saved as []. Do not pass null or non-string elements. Allow null: True Example: []How to obtain or fill in: Collect actual source names from the same category; do not mix in service/app_id from other categories. |
|
| filters | array | Condition array, combined with source conditions using AND; when omitted, it is saved as an empty condition. Empty sources and empty conditions may generate {} with no scope restriction; it is recommended to explicitly submit an effective filter scope. Allow null: True Example: [{"name": "path", "condition": "and", "operation": "=", "value": ["/healthz"]}]How to obtain or fill in: Construct with actual data fields; refer to the field names and types in data details or field management. |
Additional Parameter Notes¶
Fields are submitted in the JSON Body; use the request example on this page. The current create Body does not fully validate required fields, types, and lengths; callers should self-check according to the field descriptions.
Request Example¶
curl --request POST 'https://openapi.guance.com/api/v1/blacklist/add' \
-H 'DF-API-KEY: <DF-API-KEY>' \
-H 'Content-Type: application/json' \
--data-raw '{"name":"忽略健康检查日志","desc":"过滤生产nginx健康检查请求。","type":"logging","source":"nginx","sources":[],"filters":[{"name":"path","condition":"and","operation":"=","value":["/healthz"]}]}'
Response¶
HTTP 200, application/json. The example below shows the main fields that can be read directly.
| Field | Type | Description |
|---|---|---|
| content.id | integer or null | Record ID; for newly created/imported items, the pre-persistence snapshot may be null; use uuid for operations. |
| content.uuid | string | UUID of the blist_ rule. |
| content.workspaceUUID | string | UUID of the workspace to which it belongs. |
| content.name | string | Rule name. |
| content.desc | string | Rule description. |
| content.type | string | Data category. |
| content.source | string | Saved single/all-sources expression; may be empty. |
| content.sources | array<string> |
Saved multiple source names; takes precedence when non-empty. |
| content.sources[] | string | Single source name. |
| content.filters | array<object> or object or null | Original condition array; historical records may also be {} or null. |
| content.filters[].name | string | Leaf field name or historical group placeholder name. |
| content.filters[].condition | string | Connector at the same level. |
| content.filters[].operation | string | Operator; historical items may use op and omit this field. |
| content.filters[].op | string | Historical operator alias; may be omitted. |
| content.filters[].value | JSON | Saved value or array of values. |
| content.filters[].value[] | JSON | Single original value. |
| content.filters[].filters | array<object> |
Nested condition group; may be omitted; recursively uses the same condition structure. |
| content.conditions | string | Generated condition expression used for filter execution; check this field for numeric conversion results; it is not written back directly. |
| content.status | integer | 0 enabled, 2 disabled, 3 deleted; non-deleted queries include disabled rules. |
| content.creator | string | Creator identity UUID. |
| content.updator | string | Updater identity; may be empty. |
| content.createAt | integer | Creation time in Unix seconds. |
| content.updateAt | integer | Last update time in Unix seconds; -1 if not updated. |
| content.deleteAt | integer | Soft deletion time in Unix seconds; -1 if not deleted. |
| content.declaration | object or null | Workspace common declaration attached to non-empty business objects; may be null or an empty object when not configured. |
{
"code": 200,
"content": {
"id": null,
"uuid": "blist_example",
"workspaceUUID": "wksp_example",
"name": "忽略健康检查日志",
"desc": "过滤生产nginx健康检查请求。",
"type": "logging",
"source": "nginx",
"sources": [],
"filters": [
{
"name": "path",
"condition": "and",
"operation": "=",
"value": [
"/healthz"
]
}
],
"conditions": "{ `source` = 'nginx' and (`path` = '/healthz' )}",
"status": 0,
"creator": "wsak_example",
"updator": "",
"createAt": 1785427200,
"updateAt": -1,
"deleteAt": -1,
"declaration": {}
},
"errorCode": "",
"message": "",
"success": true,
"traceId": "TRACE-EXAMPLE"
}
Error Responses¶
For authentication, rate limiting, and common request errors, see Common Error Definitions.
| HTTP Status | errorCode | Trigger Condition | Message or Response Description | Handling |
|---|---|---|---|---|
| 400 | ft.RequestJsonFormatError | Invalid request JSON syntax | Request JSON format error | Correct the JSON according to content.reason, line, and column. |
| 406 | ft.ParameterValidationFailed | A member of non-empty filters is missing name/condition/value, or the condition group format is incorrect | Parameter parsing failed | Check filters item by item; the create Body does not perform complete declaration validation. |
| 400 | ft.NameRepeat | Name duplication among non-deleted rules in the same workspace; disabled rules are also checked | Name already exists | Use a unique name or modify the existing rule. |
| 404 | ft.AlreadyExistsSameSourceAndConditions | A rule with exactly the same generated conditions already exists for the same type in the same workspace, including disabled rules | The blacklist rule already exists; adjust it again | Query the existing rule and modify/enable it; do not retry creation indefinitely; the error HTTP status is 404. |
| 406 | ft.DataSourceMismatch | type cannot be mapped to a supported data category | Data source mismatch | Use a data category supported by the target site and verify the spelling. |
| 406 | ft.InvalidOperationSymbol | The condition operator is not in the supported set | Invalid operator {} |
Use the operator table on this page. |
| 400 | ft.SpecialCharactersExist | The condition field name contains a backtick | Special characters exist on the left side of the operator | Use the original field name and remove any manually added backticks. |
| 500 | ft.InternalServerError | Database, storage length/null, field shape, or subsequent processing exception | Internal error | Query the rule and its configuration before deciding to retry; retain the traceId if the failure persists. |
| 403 | ft.Forbidden | The API Key lacks permission for the current operation | You do not have permission to perform this operation | Use an API Key for the current workspace with the permissions required for this page. Verify actual feature availability against the site configuration. |