Skip to content

Import



POST /api/v1/blacklist/import

Overview

Batch import blacklist configurations, and deduplicate or update them based on existing sources/conditions.

Before Calling and Usage Steps

Put the exported content.blacklists into Body.blacklists of this API, and explicitly select blacklistType. First verify the name, data category, source, and field type in the target Workspace. Do not directly use the unified export wrapper as the Body of this API. Import does not accept retaining status or UUID-targeted overwrites.

Each item must have type, non-empty filters, and at least one of source/sources; errors in the internal shape of a field may cause 500. The duplicate name check occurs before log category skipping and condition deduplication, and names within the same batch must also not be duplicated. If (source,conditions) is exactly the same as an existing non-deleted record, update that record with a new and unused name and desc, retaining the original status, type, original filters, and other remaining fields; the determination does not include type, so you should not rely on it for targeted cross-type updates. For new items in the same batch with the same (source,conditions), only the first is retained, and no per-item skip reason is returned; multiple items that hit the same old item may overwrite it in sequence.

The returned snapshot id of the new object may be null; after completion, read it back using the list/details. If an exception occurs before the final commit, database changes in this batch are usually rolled back, but do not treat the error as confirmation that the data was not saved; verify the current state before retrying.

Leaf operations: = (is), != (is_not/is not), >/>=/<!--<= take only the first value; in and not_in (not in) match a set; match/contain and not_match/not_contain perform contains matching; regexp (re) and not_regexp perform regex, and the regex value should be the raw expression; wildcard/not_wildcard use string wildcard values; exist/exists and not_exist/not_exists check field existence. The exist types still require a non-empty value array to pass the current validation; you can fill in ["ignored"], and this 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 perform inference, the original string is retained; string matching/regex is 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 progress of downstream pipeline propagation; after the change, verify the actual scope with controlled samples.

Request Headers

Parameter Name Type Required Description
DF-API-KEY string Y OpenAPI authentication credential for the Workspace.Example: <DF-API-KEY>
How to obtain or fill in: Obtain an OpenAPI Key with this operation permission from API Key Management in the target Workspace.

Body Request Parameters

Parameter Name Type Required Description
blacklists[*] json Single import object; fields within the array are not subject to complete declaration validation; do not pass null or a non-object.
Example: {"name": "忽略健康检查日志", "desc": "过滤生产nginx健康检查请求。", "type": "logging", "source": "nginx", "sources": [], "filters": [{"name": "path", "condition": "and", "operation": "=", "value": ["/healthz"]}]}
How to obtain or fill in: Use an exported configuration as a template and replace the target source and values.
blacklists[*].name string Recommended to be non-empty, unique, and within 48 characters; if omitted, a name is generated. Conflicts with names in the same batch or existing rules both report an error.
Example: 忽略健康检查日志
How to obtain or fill in: Name it according to business needs; first check whether it already exists in the same Workspace from the Blacklist List.
blacklists[*].desc string Optional description, declared length 256 characters. Omitting it on modification clears it to ""; an empty string can clear it.
Example: 过滤生产nginx健康检查请求。
How to obtain or fill in: Enter the purpose of the rule and the expected impact.
blacklists[*].type string Data category, not rule status. mapping determines the meaning of source; unsupported types may return DataSourceMismatch, and the declared text is not enum validation.
Example: logging
How 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, and the target data pipeline itself must support them.
blacklists[*].source string At least one of the source field and sources must be non-empty; when sources is non-empty, it takes precedence. It is recommended to choose only one. You cannot provide only filters and omit the source.
Example: nginx
How to obtain or fill in: Obtain 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.
blacklists[*].sources array An array of multiple exact source names; when non-empty, they are combined with IN and take precedence over source; [] falls back to source, omitting means [], and omitting on modification clears it. Do not pass null or non-string elements.
Example: []
How to obtain or fill in: Collect from actual source names of the same category; do not mix in service/app_id from other categories.
blacklists[*].sources[*] string A single source name; do not fill in a UUID or regex wrapper; use the top-level source for all sources.
Example: nginx
How to obtain or fill in: Enter a single real source name.
blacklists[*].filters array Import conditions must be non-empty; even if the source is valid, filters=[] also reports MissingParameters.
Example: [{"name": "path", "condition": "and", "operation": "=", "value": ["/healthz"]}]
How to obtain or fill in: Construct using real data fields; you can refer to the field names and types in data details or field management.
blacklists[*].filters[*] json A single leaf condition. It is recommended to explicitly provide name/condition/operation/value; array members are not subject to complete declaration validation, and shape errors may cause 500.
Example: {"name": "path", "condition": "and", "operation": "=", "value": ["/healthz"]}
How to obtain or fill in: Construct based on real data fields, matching operations, and actual values.
blacklists[*].filters[*].name string Required non-empty field name; names containing backticks are rejected. A successful save does not guarantee that the field exists; verify the data.
Example: path
How to obtain or fill in: Obtain the real field name from data details or the field list of the corresponding type; do not use display aliases.
blacklists[*].filters[*].condition string It is recommended to use only and/or; the connector of the first condition is ignored. The current lenient validation does not guarantee that all invalid logic is rejected, and clients should constrain it themselves.
Example: and
How to obtain or fill in: If the previous condition at the same level has an AND relationship, enter and; for an OR relationship, enter or.
blacklists[*].filters[*].operation string It is recommended to explicitly provide the operator string; for the compatible field op, see the supplementary note. For the value semantics of different operators, see the description.
Example: =
How to obtain or fill in: Choose from the operator descriptions on this page, such as =, in, match, regexp, exist.
blacklists[*].filters[*].op string Old alias of operation; if both are provided, operation takes precedence. It is recommended to use operation consistently.
Example: =
How to obtain or fill in: It can be used when compatible with historical condition structures.
blacklists[*].filters[*].value JSON Recommended to be a non-empty array. =, !=, comparison, regexp/wildcard, etc. are processed according to the rules of each operator; = and comparison take only the first value, while in/match support multiple. Do not use null or an empty array.
Example: ["/healthz"]
How to obtain or fill in: Enter real field values; for numeric conditions, it is recommended to use JSON numbers directly, and use strings for text.
blacklists[*].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, and the saved filters still retain the original input.
Example: /healthz
How to obtain or fill in: Take the real field value; use the numeric type for numeric fields, and keep the unit consistent with the original field.
blacklists[*].filters[*].filters array Optional nested group, recursively using the same structure; the current check_filters also requires a group to have a non-empty name/condition/value, and a common group with only condition+filters may return 406. For normal calls, prefer flattened 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.
blacklists array Y Required array of configuration objects, not a JSON string/file; [] returns [] successfully. Each item should have a non-empty source and filters.
Allowed null: False
Example: [{"name": "忽略健康检查日志", "desc": "过滤生产nginx健康检查请求。", "type": "logging", "source": "nginx", "sources": [], "filters": [{"name": "path", "condition": "and", "operation": "=", "value": ["/healthz"]}]}]
How to obtain or fill in: You can use content.blacklists returned by export, or fill it in according to the single-item structure below.
blacklistType string Y Required, logging/all. logging mode skips items whose type is not logging, but the duplicate name check occurs before skipping; all mode processes each supported category item by item.
Optional values: ['logging', 'all']
Example: logging
How to obtain or fill in: For import dedicated to the Log menu, enter logging; for cross-category management import, enter all.

Request Example

curl --request POST 'https://openapi.guance.com/api/v1/blacklist/import' \
  -H 'DF-API-KEY: <DF-API-KEY>' \
  -H 'Content-Type: application/json' \
  --data-raw '{"blacklistType":"logging","blacklists":[{"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 array<object> Array of rule snapshots created/updated in this request; [] for empty input or when all items are skipped, not a per-item result report.
content[].id integer or null Record number; for newly created/imported items it is a pre-persistence snapshot and may be null; use uuid for operations.
content[].uuid string blist_ rule UUID.
content[].workspaceUUID string UUID of the Workspace it belongs to.
content[].name string Rule name.
content[].desc string Rule description.
content[].type string Data category.
content[].source string Saved single/all-source expression; may be empty.
content[].sources array<string> Saved multiple source names; when non-empty, takes precedence.
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 placeholder name of a historical group.
content[].filters[].condition string Connector at the same level.
content[].filters[].operation string Operator; historical items may use op and omit this.
content[].filters[].op string Historical operator alias; may be omitted.
content[].filters[].value JSON Saved value or value array.
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; numeric conversion results are shown in this field and are not written back directly.
content[].status integer 0 enabled, 2 disabled, 3 deleted; non-deleted queries include disabled.
content[].creator string Creator identity UUID.
content[].updator string Updater identity; may be empty.
content[].createAt integer Creation Unix seconds.
content[].updateAt integer Most recent update Unix seconds; -1 if not updated.
content[].deleteAt integer Soft deletion Unix seconds; -1 if not deleted.
content[].declaration object or null Workspace public declaration attached to a non-empty business object; 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 Response

For authentication, rate limiting, and common request errors, see Common Error Definitions.

HTTP Status errorCode Trigger Condition Message or Response Description Handling
406 ft.ParameterValidationFailed Request field is missing, or the field value violates the declared validation conditions Parameter parsing failed Verify the parameter location, field name, type, and value.
400 ft.RequestJsonFormatError Request JSON syntax is invalid Request JSON format error Fix the JSON according to content.reason, line, and column.
400 ft.JsonFormatError The top level of the JSON is not an object JSON file format error in some parts Submit the JSON object in the parameter table.
400 ft.NameRepeat Duplicate with an existing name or a name in the same batch, even if the item will later be skipped due to blacklistType Name already exists First check all import names, rename them, and submit again.
406 ft.MissingParameters The item to import is missing type, non-empty filters, or a source Missing parameters Provide type, source, and non-empty filters in full for each item.
406 ft.DataSourceMismatch The type of the item to process does not support condition generation Data source mismatch Use a supported data category.
406 ft.InvalidOperationSymbol Condition operator is invalid Invalid operator {} Use an operator supported on this page.
400 ft.SpecialCharactersExist A backtick exists in the field name Special characters exist on the left side of the operator Pass the real field name without adding backticks.
500 ft.InternalServerError Database, storage length/null, field shape, or subsequent processing exception Internal error Query the rule and its configuration first before deciding to retry; if it continues to fail, retain the traceId.
403 ft.Forbidden API Key lacks the current operation permission You do not have permission to perform this operation Use an API Key in the current Workspace that has the operation permissions for this page. For actual feature availability, verify against the site configuration.

Feedback

Is this page helpful?