Skip to content

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

  1. First, upload resource.zip with the conflict handling parameters for each resource.
  2. If taskId is returned, the task has been created; you can continue polling the status API.
  3. If repeat_name / repeat_identifier is returned, duplicates exist; adjust the import strategy and resubmit.

4. Response Scenarios

4.1 Can be imported directly

{
  "taskId": "task_xxx"
}

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 simultaneously
  • identifier: only the identifier ID conflicts
  • name: only the name conflicts

Corresponding handling parameters:

  • repeatDashboardNameAndIdentifierOp
  • repeatDashboardIdentifierOp
  • repeatDashboardNameOp
  • repeatViewerNameAndIdentifierOp
  • repeatViewerIdentifierOp
  • repeatViewerNameOp

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:

  1. Environment variables do not include scope=rum.
  2. Log indexes do not include external indexes and default.
  3. Field management only handles workspace custom fields.
  4. 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

Response

{
    "code": 200,
    "content": {
        "taskId": "task_xxx"
    },
    "errorCode": "",
    "message": "",
    "success": true,
    "traceId": "TRACE-XXXX"
}