Workspace Resource Import¶
POST /api/v1/workspace/resource/upload
Overview¶
Upload the workspace resource compressed package and initiate the import.
Additional Parameter Notes¶
1. API Purpose
Upload the workspace resource compressed package and initiate an import task.
When migrating to Scopedb, for new log indexes to be created (including direct-write and clone), isFullLineIndex=0/false is automatically adapted to 1, while the original file remains unchanged. For existing indexes, skip does not modify the configuration; when a full-line index is migrated to non-Scopedb and recover requires a full-line downgrade, the entire item is skipped. The clone configuration and the source index are checked as a single item before writing. Clone indexes newly created during overwrite follow the new creation adaptation rules. Parameter, JSON, permission, or other errors such as DB/Kodo are still treated as failures. After completion, query the conversion, skip, and failure details in the task status. This adaptation does not change the behavior of the standalone log index import API.
This API is an asynchronous task interface. When there is no duplicate conflict, taskId is returned; when there is a duplicate conflict, no task is created and duplicate information is returned directly.
2. Request Type
The request type is multipart/form-data.
Required file field:
- files
3. Recommended Call Flow
- First, upload
resource.zipwith the conflict handling parameters for each resource. - If
taskIdis returned, the task has been created; you can continue polling the status API. - If
repeat_name/repeat_identifieris returned, duplicates exist; adjust the import strategy and resubmit.
4. Response Scenarios
4.1 Can be imported directly
4.2 Duplicates exist, pending caller confirmation
{
"repeat_name": {
"checker": ["CPU使用率告警"],
"tag": ["0306"]
},
"repeat_identifier": {
"dashboard": [
{
"identifier": "system_overview",
"existName": "系统概览",
"importName": "系统概览V2"
}
]
},
"repeat_conflict": {
"dashboard": {
"name_and_identifier": [
{
"name": "CPU 监控视图",
"identifier": "123",
"fileName": "dashboard/CPU 监控视图.json",
"existName": "CPU 监控视图",
"importName": "CPU 监控视图"
}
],
"identifier": [],
"name": []
}
}
}
5. Conflict Handling Parameter Descriptions
5.1 Monitors
repeatNameOp- Applicable resources: Monitors
- Available values:
check/skip/recover/continue
5.2 Dashboard and Explorer identifier IDs
repeatIdentifierOp- Applicable resources: Dashboards, Explorers
- Available values:
check/skip/recover
5.3 Three conflict groups for Dashboards and Explorers
Dashboards and Explorers detect both the name and the identifier ID simultaneously, and return results grouped into the following three categories:
name_and_identifier: name and identifier ID conflict simultaneouslyidentifier: only the identifier ID conflictsname: only the name conflicts
Corresponding handling parameters:
repeatDashboardNameAndIdentifierOprepeatDashboardIdentifierOprepeatDashboardNameOprepeatViewerNameAndIdentifierOprepeatViewerIdentifierOprepeatViewerNameOp
All the above parameters only support check / skip / recover, and both skip and recover take effect at the group level.
5.4 Duplicate name handling for other newly added resources
The following parameters only support:
- check
- skip
- recover
Including:
- repeatNotifyObjectNameOp
- repeatAlertPolicyNameOp
- repeatLogBackupCfgNameOp
- repeatSloNameOp
- repeatSecurityRuleNameOp
- repeatFieldNameOp
- repeatLabelNameOp
- repeatEnvVariableNameOp
- repeatRoleNameOp
- repeatLogIndexNameOp
- repeatBlacklistNameOp
- repeatPipelineNameOp
- repeatRegularExpressionNameOp
- repeatFieldDisplayPermissionNameOp
- repeatSensitiveDataScannerNameOp
6. Current Resource Boundary Notes
The current workspace resource import/export has the following boundaries:
- Environment variables do not include
scope=rum. - Log indexes do not include external indexes and
default. - Field management only handles workspace custom fields.
- Data Access currently does not support workspace import/export.
7. Compatibility Notes
If the compressed package contains special data that is currently unsupported or has been ignored, the system will skip it or treat it as a failure according to the current implementation rules. Refer to the task status API response for the actual results.
Request Example¶
curl 'https://openapi.truewatch.com/api/v1/workspace/resource/upload' \
-H 'DF-API-KEY: <DF-API-KEY>' \
-F 'files=@truewatch.com' \
-F 'repeatNameOp=check' \
-F 'repeatIdentifierOp=check' \
--compressed