Create¶
POST /api/v1/pipeline/add
Overview¶
Create a Pipeline
When the category type is profiling, this rule only takes effect when the CentralPLServiceSwitch field configured in the workspace (returned by the /workspace/get API) is true.
Body Request Parameters¶
| Parameter | Type | Required | Description |
|---|---|---|---|
| name | string | Y | Pipeline file name Allow empty: False Maximum length: 256 $notSearchRegExp: [^a-zA-Z0-9_\u4e00-\u9fa5-]+ |
| type | string | Y | Pipeline file type Allow empty: False Allowed values: ['local', 'central'] |
| source | array | Selected source list Allow empty: False |
|
| versionAction | string | Version source action; passed in when cloning from an official template or the current Pipeline Allow empty: False Allowed values: ['official_clone', 'current_clone'] |
|
| sourceTemplateName | string | Source template name when cloning from an official template Allow empty: False Allow empty string: False |
|
| sourcePipelineUUID | string | Source Pipeline UUID when cloning the current version Allow empty: False Allow empty string: False |
|
| sourceConfigVersion | integer | Source Pipeline configuration version number read when cloning the current version Allow empty: False $minValue: 1 |
|
| content | string | Y | Pipeline file content (base64-encoded). |
| After base64 decoding, the script is validated against Studio UI character counting rules: U+0001–U+007E and U+FF60–U+FF9F count as 1; other UTF-16 units count as 2, with a maximum of 65535. The UTF-8 encoded size of the entire decoded script must also not exceed 65535 bytes. If either limit is exceeded, ft.ContextExceedLimit is returned; byte-limit errors are reported in bytes. | |||
Allow empty: False |
|||
| testData | string | Test data (base64-encoded). On the OpenAPI side, only an empty string or content whose base64 decoding results in a JSON array is allowed. |
Generation: 1. First prepare an array of test samples; 2. Run JSON.stringify on the array; 3. Base64-encode the resulting UTF-8 string and pass it as testData.
Common examples: - Empty sample array: [] -> W10= - Single JSON log entry: [{"level":"info","msg":"HTTP"}] -> W3sibGV2ZWwiOiJpbmZvIiwibXNnIjoiSFRUUCJ9XQ== - Single text log entry: ["raw log line"] -> WyJyYXcgbG9nIGxpbmUiXQ==
Invalid example: Directly base64-encoding {"level":"info","msg":"HTTP"} and passing it in, because the decoded top-level is an object, not an array.
Allow empty: False
Allow empty string: True
|
| dataType | string | | Data type: line_protocol - Line protocol format; json - JSON format; message - Message
Example: line_protocol
Allow empty: False
Allow empty string: True
Allowed values: ['line_protocol', 'json', 'message']
|
| isForce | boolean | | Whether to replace when a default exists for the specific type
Allow empty: False
|
| category | string | Y | Category
Allow empty: False
Allow empty string: False
Allowed values: ['logging', 'object', 'custom_object', 'network', 'tracing', 'rum', 'llm', 'agent_monitor', 'security', 'keyevent', 'metric', 'profiling', 'dialtesting', 'billing', 'keyevent']
|
| asDefault | int | | Whether to use as the default pipeline for this type; 1 sets as default, 0 as non-default
Allow empty: False
|
| enableByLogBackup | int | | Enable Pipeline to process forwarded data; 1 to enable, 0 to disable
Allow empty: False
|
| extend | json | | Category
Allow empty: False
|
| extend.appID | array | | appID
Allow empty: True
|
| extend.measurement | array | | Source
Allow empty: True
|
| extend.loggingIndex | string | | Log Index
Allow empty: True
|
| extend.ifAiCreate | boolean | | Whether it is an AI-generated parsing rule
Allow empty: True
|
| extend.aiTargetStructure | string | | AI-extracted content
Allow empty string: True
Allow empty: True
|
| extend.exampleSource | string | | Example source
Allow empty string: True
Allow empty: True
|
| extend.exampleType | string | | Example type
Allow empty string: True
Allow empty: True
|
Additional Parameter Notes¶
Request Example¶
curl 'https://openapi.guance.com/api/v1/pipeline/add' \
-H 'DF-API-KEY: <DF-API-KEY>' \
-H 'Content-Type: application/json;charset=UTF-8' \
--data-raw '{"name":"openapi_test","category":"logging","asDefault":0,"content":"YWRkX2tleShjaXR5LCAic2hhbmdoYWkiKQ==","testData":"W3sibGV2ZWwiOiJpbmZvIiwibXNnIjoiSFRUUCJ9XQ==","source":["nsqlookupd"]}' \
--compressed
Response¶
{
"code": 200,
"content": {
"asDefault": 0,
"category": "logging",
"content": "YWRkX2tleShjaXR5LCAic2hhbmdoYWkiKQ==\n",
"createAt": 1678026470,
"creator": "xxxx",
"deleteAt": -1,
"extend": {},
"id": null,
"isSysTemplate": null,
"name": "openapi_test",
"status": 0,
"testData": "W10=\n",
"updateAt": 1678026470,
"updator": "xxxx",
"uuid": "pl_xxxx32",
"workspaceUUID": "wksp_xxxx32"
},
"errorCode": "",
"message": "",
"success": true,
"traceId": "TRACE-74509B6F-DE3D-4905-AC9F-4FD96ED78EC3"
}