Import¶
POST /api/v1/pipeline/import
Overview¶
Batch-create Pipeline templates, handling default replacement confirmation and syntax validation.
Before Calling and Usage Steps¶
Use the exported pipelines array and verify the sources against the target workspace. Items with an existing name in the same category or an exact source conflict in the same category/type are skipped directly and not overwritten; fail_count includes skipped items, so not all of them should be understood as errors. Sources containing * or ? do not participate in exact conflict comparison. Candidates with the same name in the same category in the same batch are rejected by the pre-compilation check; avoid multiple entries with asDefault=1 in the same category/type in the same batch.
When confirm is returned, the entire batch is not written; after confirmation, retry with isForce=true. Forced default replacement is deferred until syntax validation passes for all candidates. All candidate scripts are compiled in a shared dependency view and can reference later candidates; if syntax fails, the entire batch is not committed. The current import does not apply isDisable, and successfully created entries are enabled by default; historical version numbers are not retained. rum/llm imports follow the template source relationships and do not use the Cartesian rebuild of extend used by single create; it is recommended to use an exported template of the same version directly and not manually assemble internal associations.
Each examples item encodes a single JSON value, while the legacy testData format encodes the entire array. The current import does not fully reuse the public add's sample array/per-item 20KiB validation; callers should still control sample size and type. Internal template fields are not enforced item by item, and malformed shapes can return 500.
Saving synchronously validates syntax and updates the configuration/version. Whether actual collection or central processing takes effect depends on subsequent configuration retrieval and the data flow; historical data is not reprocessed, and parsed sample results are not returned. Back up the details before modification; after an error/timeout, read back the current version before retrying.
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 |
|---|---|---|---|
| pipelines[*] | json | New template; does not overwrite existing entries with the same name or source. Fields not listed should not be relied on. Example: {"name": "production_parser", "type": "local", "category": "logging", "asDefault": 0, "enableByLogBackup": 0, "source": ["nginx"], "isDisable": false, "content": "YWRkX2tleSgiZW52IiwgInByb2R1Y3Rpb24iKQ==", "examples": [{"data": "eyJtZXNzYWdlIjoiZXhhbXBsZSBsb2cifQ=="}], "dataType": "json", "extend": {"loggingIndex": "default"}}How to obtain or fill in: Use an exported template as the basis and replace the target name and source. |
|
| pipelines[*].name | string | Required; maximum 256 counting units (ASCII/half-width katakana 1, other characters 2); allows alphanumeric characters, underscores, Chinese characters U+4e00..9fa5, and hyphens; non-empty is recommended. Duplicates in the same category are not allowed, even if local/central differs or the old entry is disabled. This is not the input log source. Example: production_parserHow to obtain or fill in: Use a business-defined filename; first check non-deleted names in the same category from the Pipeline list. |
|
| pipelines[*].type | string | Required; local/central. For synthetic testing, dialtesting creation/modification can only be central. The workspace edition may restrict central. Modification replaces the original runtime type. Example: localHow to obtain or fill in: Choose local for processing by the local collector, or central for platform central processing; verify the actual data entry point. |
|
| pipelines[*].category | string | Required; lineage/logging/object/custom_object/network/tracing/rum/llm/agent_monitor/security/keyevent/metric/profiling/dialtesting/cloud_billing; billing is a legacy compatibility value. Modification can change the category, and the script, source, and extend need to be checked together. Example: loggingHow to obtain or fill in: Choose according to the target data domain and collection configuration. |
|
| pipelines[*].source | array | Optional; default []. Omitting it on modification removes all source relationships. Sources containing * or ? do not participate in exact uniqueness conflict checks, and runtime behavior for all matches is not guaranteed; a normal exact source cannot be occupied by another non-deleted Pipeline within the same category/type. For rum/llm create/modify, this array is ignored; use extend.appID and measurement instead. Example: ["nginx"]How to obtain or fill in: Take the value from the source or source selector of the corresponding collected data, not from the Pipeline name; for logs, refer to the actual log source. |
|
| pipelines[*].source[*] | string | Non-empty strings are recommended; the array is not strictly validated item by item. Do not mix unrelated data domains. Example: nginxHow to obtain or fill in: A single real source identifier, or a wildcard pattern supported by the collection side. |
|
| pipelines[*].content | string | Required base64 string; after decoding, it must be non-empty on create. The decoded script text must satisfy both a UI character count ≤1048576 and a UTF-8 byte size ≤1048576; non-ASCII BMP characters count as 2 and supplementary characters as 4. If either limit is exceeded, ft.ContextExceedLimit is returned. Saving synchronously compiles without samples and checks references to enabled scripts in the same category; success does not mean real-data debugging has passed or that the script has taken effect. Example: YWRkX2tleSgiZW52IiwgInByb2R1Y3Rpb24iKQ==How to obtain or fill in: First write the UTF-8 Pipeline script, then perform standard base64 encoding; the example decodes to add_key("env", "production"). |
|
| pipelines[*].dataType | string | Optional; default line_protocol; supports line_protocol/json/message. Omitting it on modification restores line_protocol; it is not category. Although an empty string is declared compatible, explicitly choose a supported value. Example: jsonHow to obtain or fill in: Choose according to the testData sample and script input. |
|
| pipelines[*].asDefault | integer | Optional; default 0; it is recommended to use only 0/1. If a default already exists and isForce is not set, HTTP 200 returns a confirm array; the target configuration in this request is not saved, and this should not be treated as a successful create/modify. Example: 0How to obtain or fill in: Use 1 when you want it to act as the fallback rule for the same category/type; otherwise 0. |
|
| pipelines[*].enableByLogBackup | integer | Optional; default 0; 0/1 is recommended. Saving the flag does not guarantee that existing forwarded data will be automatically reprocessed. Example: 0How to obtain or fill in: Use 1 when the rule needs to process forwarded data; confirm support from the actual data forwarding chain. |
|
| pipelines[*].extend | json | Optional; default {}. Modification replaces the entire object and does not merge. rum/llm use the appID × measurement combination to generate source relationships; unknown subfields are rejected by public validation. Example: {"loggingIndex": "default"}How to obtain or fill in: Organize the following declared fields according to the category and existing details. |
|
| pipelines[*].extend.appID | array | rum/llm should provide a non-empty array together with measurement; if both are empty, there may be no dedicated source; if appID is present without measurement, a missing parameter error is reported. Example: ["appid_example"]How to obtain or fill in: Obtain the real appId from the corresponding RUM/LLM application management. |
|
| pipelines[*].extend.measurement | array | rum/llm performs a Cartesian combination with appID; if measurement is present but appID is not, a missing parameter error is reported. Saving does not verify that every application/measurement actually has data. Example: ["view"]How to obtain or fill in: Obtain it from the measurement of the application's real data, such as RUM view/action, and fill it in according to the actual category. |
|
| pipelines[*].extend.loggingIndex | string | Optional log index echo field; no value is added by default. If omitted on modification, it is cleared along with extend; this is not the source array. Example: defaultHow to obtain or fill in: Obtain the applicable index identifier from the Log Index list. |
|
| pipelines[*].extend.ifAiCreate | boolean | Optional echo field; does not trigger an AI task. Example: falseHow to obtain or fill in: Record whether it was generated with AI assistance; omit this flag if it is not needed. |
|
| pipelines[*].extend.aiTargetStructure | string | Optional string; saved only for echo purposes; this API does not generate scripts. Example: How to obtain or fill in: Description of the target structure when generated by AI; omit it if not needed. |
|
| pipelines[*].extend.exampleSource | string | Optional echo field; does not replace the source association. Example: nginxHow to obtain or fill in: Display value for the sample source; it must correspond to the real source. |
|
| pipelines[*].extend.exampleType | string | Optional echo string; the server does not provide a fixed enumeration. Example: customHow to obtain or fill in: Display value for the sample type, defined by client business logic. |
|
| pipelines[*].extend.appID[*] | string | Non-empty strings are recommended. Example: appid_exampleHow to obtain or fill in: Obtain a single appId from the application configuration. |
|
| pipelines[*].extend.measurement[*] | string | Non-empty strings are recommended. Example: viewHow to obtain or fill in: The original name of the real measurement. |
|
| pipelines[*].isDisable | boolean | Original state at export time; the current public import does not apply this flag, and entries are enabled by default after import. Example: falseHow to obtain or fill in: Obtain it from the corresponding field in the exported template; its configuration meaning is the same as described on this page. |
|
| pipelines[*].examples | array<object> |
Takes precedence over legacy testData; valid JSON encodings of objects/strings are recommended. Invalid JSON decoded content may be saved as null instead of the original text. Example: [{"data": "eyJtZXNzYWdlIjoiZXhhbXBsZSBsb2cifQ=="}]How to obtain or fill in: For each sample, first serialize the JSON value, then encode it as UTF-8 base64. |
|
| pipelines[*].examples[*] | json | Non-empty objects are recommended. Example: {"data": "eyJtZXNzYWdlIjoiZXhhbXBsZSBsb2cifQ=="}How to obtain or fill in: A single {data:base64} object. |
|
| pipelines[*].examples[*].data | string | Encoding of a valid JSON value, not the entire sample array; it differs in encoding level from testData on create. Example: eyJtZXNzYWdlIjoiZXhhbXBsZSBsb2cifQ==How to obtain or fill in: For example, UTF-8 base64 of a single JSON object. |
|
| pipelines[*].testData | string | Optional legacy format; examples takes precedence when present. Use W10= instead of omitting it to prevent decoding to None. Example: W10=How to obtain or fill in: Use only when the old template has no examples; encodes the entire sample array. |
|
| pipelines | array | Y | Required array; an empty array succeeds with zero counts. Each item is a template object, and full field declaration validation is not performed internally; do not pass it directly as a unified response. Allows null: False Example: [{"name": "production_parser", "type": "local", "category": "logging", "asDefault": 0, "enableByLogBackup": 0, "source": ["nginx"], "isDisable": false, "content": "YWRkX2tleSgiZW52IiwgInByb2R1Y3Rpb24iKQ==", "examples": [{"data": "eyJtZXNzYWdlIjoiZXhhbXBsZSBsb2cifQ=="}], "dataType": "json", "extend": {"loggingIndex": "default"}}]How to obtain or fill in: Take the array from content.pipelines in the export response. |
| isForce | boolean | Optional; default false. Used only to confirm a default conflict and cannot skip syntax, source, name, version, or other validation; forced replacement changes the original default to non-default and archives its version. Allows null: False Example: falseHow to obtain or fill in: After receiving content.confirm, confirm replacement of the original default Pipeline, then set to true. |
|
| pipelineType | string | Y | Required; logging/all. logging skips non-log items, but some restriction/confirmation checks occur before category skipping. Allowed values: ['logging', 'all'] Example: allHow to obtain or fill in: Use all to manage multi-category imports, or logging for log-only imports. |
Request Example¶
curl --request POST 'https://openapi.guance.com/api/v1/pipeline/import' \
-H 'DF-API-KEY: <DF-API-KEY>' \
-H 'Content-Type: application/json' \
--data-raw '{"pipelineType":"all","isForce":false,"pipelines":[{"name":"production_parser","type":"local","category":"logging","asDefault":0,"enableByLogBackup":0,"source":["nginx"],"isDisable":false,"content":"YWRkX2tleSgiZW52IiwgInByb2R1Y3Rpb24iKQ==","examples":[{"data":"eyJtZXNzYWdlIjoiZXhhbXBsZSBsb2cifQ=="}],"dataType":"json","extend":{"loggingIndex":"default"}}]}'
Response¶
HTTP 200, application/json. The examples below show the main fields that can be read directly.
| Field | Type | Description |
|---|---|---|
| content.success_count | integer | Number of successfully created candidates. |
| content.fail_count | integer | Input count minus success count, including skipped items; no per-item reason is provided. |
| content.declaration | object | Common declaration. |
| content.confirm | array<string> |
Replaces the normal entity on default conflict and lists the categories that require replacement confirmation; this branch does not save the target of this request. |
| content.confirm[] | string | A single category. |
| content.pl_errors | array<object> |
The compilation error array returned only in the content of an ft.PipelineSyntaxError error. |
| content.pl_errors[].error | string | Compilation error description. |
| content.pl_errors[].pos_chain | array<object> |
Reference/location chain. |
| content.pl_errors[].pos_chain[].file | string | File name. |
| content.pl_errors[].pos_chain[].ln | integer | Non-negative position index defined by the compiler; preserve the original value for troubleshooting. |
| content.pl_errors[].pos_chain[].col | integer | Non-negative position index defined by the compiler; preserve the original value for troubleshooting. |
| content.pl_errors[].pos_chain[].pos | integer | Non-negative position index defined by the compiler; preserve the original value for troubleshooting. |
{
"code": 200,
"content": {
"success_count": 1,
"fail_count": 0,
"declaration": {}
},
"errorCode": "",
"message": "",
"success": true,
"traceId": "TRACE-EXAMPLE"
}
Pending default confirmation:
{
"code": 200,
"content": {
"confirm": [
"logging"
],
"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 |
|---|---|---|---|---|
| 406 | ft.ParameterValidationFailed | Request field is missing, or the field value violates the declared validation condition | Parameter parsing failed | Check the parameter location, field name, type, and value. |
| 400 | ft.RequestJsonFormatError | Invalid request JSON syntax | Request JSON format error | Correct the JSON according to content.reason, line, and column. |
| 406 | ft.InvalidBase64 | The script/test sample is not decodable UTF-8 base64; omitting testData on create may also trigger this | Invalid base64 content | Provide content and testData completely; encode as UTF-8 first, then base64. |
| 406 | ft.ContextExceedLimit | The script exceeds the UI character count or 1 MiB of UTF-8 bytes, or a single add/modify test sample exceeds the historical length | Text content exceeds the limit; limit is {} characters | Reduce the script/single sample and check the unit indicated in message. |
| 406 | ft.PipelineSyntaxError | Synchronous compilation without samples returns a script or reference syntax error | Pipeline script syntax error; check the error location | Locate and correct the issue according to error and pos_chain in content.pl_errors, then retry. |
| 400 | ft.PipelineNameExists | Candidate scripts with the same name in the same category in the same batch | A Pipeline with the same name already exists | Deduplicate the template names first. |
| 403 | ft.ForbiddenFreeEditionWorkspace | A candidate type does not match the workspace edition | The Free Plan workspace does not support this feature. Subscribe to the Commercial Plan to unlock the restriction | Adjust the target runtime type. |
| 403 | ft.ForbiddenFreeWKSPCentralPipeline | Importing central into a free/trial workspace | The Free Plan workspace does not support central Pipeline configuration | Confirm that the workspace edition supports it. |
| 500 | ft.InternalServerError | The synchronous compilation service is unavailable/timed out/has a format exception (the internal PipelineValidationUnavailable is ultimately wrapped uniformly), or a database, structure error, or post-commit formatting failure occurs | Internal error | Before retrying later, read the current configuration and version to confirm whether it has already been saved; if the failure persists, provide the traceId. |