Create¶
POST /api/v1/pipeline/add
Overview¶
Create a Pipeline
When the category is profiling, the rule will only take effect if the field CentralPLServiceSwitch (returned by the /workspace/get API) is true in the workspace configuration.
Body Request Parameters¶
| Parameter Name | Type | Required | Description |
|---|---|---|---|
| name | string | Y | Pipeline file name Allow empty: False Max length: 256 $notSearchRegExp: [^a-zA-Z0-9_\u4e00-\u9fa5-]+ |
| type | string | Y | Pipeline file type Allow empty: False Optional values: ['local', 'central'] |
| source | array | Selected source list Allow empty: False |
|
| content | string | Y | Pipeline file content (base64 encoded). After base64 decoding, the script is validated by Studio UI's character counting rules: U+0001–U+007E, U+FF60–U+FF9F count as 1, other UTF-16 units count as 2, max 10240. Allow empty: False |
| testData | string | Test data (base64 encoded). The OpenAPI side only allows an empty string or content that after base64 decoding is a JSON array. Generation method: 1. First prepare the test sample array; 2. Execute JSON.stringify on the array; 3. Base64 encode the obtained UTF-8 string and pass it as testData. Common examples: - Empty sample array: [] -> W10= - Single JSON log: [{"level":"info","msg":"HTTP"}] -> W3sibGV2ZWwiOiJpbmZvIiwibXNnIjoiSFRUUCJ9XQ== - Single text log: ["raw log line"] -> WyJyYXcgbG9nIGxpbmUiXQ== Invalid example: Directly base64 encoding {"level":"info","msg":"HTTP"} 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 Optional values: ['line_protocol', 'json', 'message'] |
|
| isForce | boolean | Whether to replace when the specific type has a default Allow empty: False |
|
| category | string | Y | Category Allow empty: False Allow empty string: False Optional values: ['logging', 'object', 'custom_object', 'network', 'tracing', 'rum', 'llm', 'agent_monitor', 'security', 'keyevent', 'metric', 'profiling', 'dialtesting', 'billing', 'keyevent'] |
| asDefault | int | Whether to set as default pipeline for this category, 1 for default, 0 for non-default Allow empty: False |
|
| enableByLogBackup | int | Enable Pipeline to process forwarded data, 1 for enable, 0 for 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 |
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"
}