Clone Historical Version¶
POST /api/v1/pipeline_history/{pipeline_history_uuid}/clone
Overview¶
Create a new Pipeline v1 from historical configuration; when source is omitted, the historical value is used by default, an explicit empty array overrides it with an empty value, and creation validation is still performed.
Route Parameters¶
| Parameter | Type | Required | Description |
|---|---|---|---|
| pipeline_history_uuid | string | Y | The historical UUID returned by the history list historyRecord[].uuid, not the Pipeline UUID or numeric id. |
Body Request Parameters¶
| Parameter | Type | Required | Description |
|---|---|---|---|
| name | string | Y | New Pipeline name Allow empty: False Allow empty string: False Max length: 256 $notSearchRegExp: [^a-zA-Z0-9_\u4e00-\u9fa5-]+ |
| type | string | Y | New Pipeline run type Allow empty: False Allowed values: ['local', 'central'] |
| source | array | Optional new source list; the historical version source is used by default Allow empty: False |
|
| isForce | boolean | Default Pipeline conflict confirmation Allow empty: False |
Additional Parameter Notes¶
Create an independent Pipeline from the specified historical configuration, suitable for retaining old versions, creating new rules, or switching run types; the source Pipeline is not modified.
Parameters and Behavior¶
name and type are required; type=local indicates a local Pipeline, and type=central indicates a central Pipeline. The new name is up to 256 characters, and the allowed character constraints are consistent with the regular creation API. The name and source must pass the existing creation validation.
When source is not specified, the historical value is inherited; an explicit [] replaces it with an empty list; an explicit non-empty array uses the new list. Special categories are still assembled according to existing business rules, so an empty array does not guarantee bypassing category validation or source conflicts. Inheriting the historical source often conflicts with the original Pipeline; it is recommended to select a new source based on the target run type and category.
The new resource starts at configVersion=1, and the source is marked as history/history_clone, retaining the source history UUID, Pipeline UUID, and version number. Cloning does not inherit the entire history chain of the original resource, nor does it automatically set the resource as the default Pipeline (asDefault=0). The remaining configuration comes from the historical snapshot; content, category, or extend cannot be arbitrarily submitted in this request. For further editing, call the regular modification API after cloning.
isForce is a default conflict confirmation parameter retained for alignment with Front, and defaults to false; historical cloning is currently fixed at asDefault=0, so it is usually not needed. This parameter cannot skip name/source validation.
Prerequisites¶
Call the OpenAPI service using the DF-API-KEY of the owning Workspace. Queries require read permissions; restore and clone require Pipeline management and write permissions. The API does not support specifying another Workspace or operator through the request body. The Endpoint, resource UUID, and API-Key in the examples are placeholders; replace them before calling, and do not output the API Key in logs.
The response example uses fictional resources to display typical business fields; actual responses may contain other fields of the regular Pipeline API. Callers should be compatible with added fields.
Version Fields¶
| Field | Description |
|---|---|
| configVersion | Configuration version number; new resources start at 1; enabling or disabling does not advance this version |
| configVersionAt | Generation time of this configuration version, Unix timestamp in seconds, not milliseconds |
| configVersionOperator / configVersionOperatorInfo | Operator identifier and display information; may be an empty object when the display information cannot be parsed |
| configVersionSource / configVersionAction | Version source and action, for example openapi/modify, history/history_restore |
| configVersionSourceInfo | Supplementary source information; historical operations include pipelineHistoryUUID, pipelineUUID, configVersion |
| createAt | Archive time of the historical snapshot, which may be later than configVersionAt; the history list retention window is calculated based on this field |
Historical config.content and config.testData are Base64-encoded strings. The caller should first Base64-decode them, then read them as UTF-8; testData is test sample data and is not automatically executed by the read or restore API. Do not treat the source version number in configVersionSourceInfo as the current version number.
Response and Retry¶
On success, content is the Pipeline object from the regular creation API, and uuid is the UUID of the new resource; the source UUID is in configVersionSourceInfo. The creation operation does not provide an idempotency key. After a timeout, first check whether the target resource has been created to avoid duplicate creation or name conflicts caused by unconditional retries. If there is no permission, the source does not exist, or the owning Pipeline has been deleted, no resource is created.
Example Request¶
curl -X POST 'https://openapi.truewatch.com/api/v1/pipeline_history/<pipeline_history_uuid>/clone' -H 'DF-API-KEY: <API-Key>' -H 'Content-Type: application/json' -d '{"name":"copy","type":"local","source":[]}'
Response¶
{
"code": 200,
"content": {
"name": "copy",
"type": "local",
"category": "logging",
"source": [],
"content": "YWRkX2tleShjaXR5LCAic2hhbmdoYWkiKQ==",
"testData": "W10=",
"dataType": "line_protocol",
"asDefault": 0,
"enableByLogBackup": 0,
"extend": {},
"id": 11,
"uuid": "pl_copy",
"workspaceUUID": "wksp_example",
"status": 0,
"creator": "acnt_example",
"updator": "acnt_example",
"createAt": 1788799900,
"updateAt": 1788800200,
"deleteAt": -1,
"configVersion": 1,
"configVersionAt": 1788800200,
"configVersionOperator": "acnt_example",
"configVersionSource": "history",
"configVersionAction": "history_clone",
"configVersionSourceInfo": {
"pipelineHistoryUUID": "plh_example",
"pipelineUUID": "pl_example",
"configVersion": 2
}
},
"errorCode": "",
"message": "",
"success": true,
"traceId": "TRACE_EXAMPLE"
}