Skip to content

Workspace Resource Import



POST /api/v1/workspace/resource/upload

Overview

Upload a workspace resource archive and initiate the import process.

Parameter Details

1. Interface Purpose

Upload a workspace resource archive and initiate an import task.

This is an asynchronous task interface. It returns a taskId when there are no duplicate conflicts. If duplicate conflicts exist, 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 along with conflict handling parameters for each resource type.
  2. If a taskId is returned, the task has been created, and you can proceed to poll the status interface.
  3. If repeat_name / repeat_identifier is returned, duplicates exist, and you need to adjust the import strategy and resubmit.

4. Response Branch Explanation

4.1 Can be imported directly.

{
  "taskId": "task_xxx"
}

4.2 Duplicates exist, awaiting confirmation from the caller.

{
  "repeat_name": {
    "checker": ["CPU Usage Alert"],
    "tag": ["0306"]
  },
  "repeat_identifier": {
    "dashboard": [
      {
        "identifier": "system_overview",
        "existName": "System Overview",
        "importName": "System Overview V2"
      }
    ]
  }
}

5. Conflict Handling Parameter Explanation

5.1 Monitor

  • repeatNameOp
  • Applicable Resource: Monitors
  • Allowed Values: check / skip / recover / continue

5.2 Dashboard and Explorer Identifier ID

  • repeatIdentifierOp
  • Applicable Resources: Dashboards, Explorers
  • Allowed Values: check / skip / recover

5.3 Other New Resource Duplicate Name Handling

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 Explanation

The current workspace resource import/export has the following boundaries:

  1. Environment variables do not include scope=rum.
  2. Log indices do not include external indices and default.
  3. Field management only handles workspace custom fields.
  4. Data access is currently not supported for workspace import/export.

7. Compatibility Explanation

During import, if the archive contains special data that is currently unsupported or has been marked for ignoring, the system will handle it by skipping or failing according to the current implementation rules. Please refer to the results returned by the task status interface for the actual outcome.

Request Example

curl 'https://openapi.truewatch.com/api/v1/workspace/resource/upload' \
-H 'DF-API-KEY: <DF-API-KEY>' \
-F '[email protected]' \
-F 'repeatNameOp=check' \
-F 'repeatIdentifierOp=check' \
--compressed

Response

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