Skip to content

Workspace Resource Import



POST /api/v1/workspace/resource/upload

Overview

Upload a workspace resource archive and initiate an import.

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 Calling Process

  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 Ready for direct import

{
  "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"
      }
    ]
  },
  "repeat_conflict": {
    "dashboard": {
      "name_and_identifier": [
        {
          "name": "CPU Monitoring View",
          "identifier": "123",
          "fileName": "dashboard/CPU Monitoring View.json",
          "existName": "CPU Monitoring View",
          "importName": "CPU Monitoring View"
        }
      ],
      "identifier": [],
      "name": []
    }
  }
}

5. Conflict Handling Parameter Details

5.1 Checker

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

5.2 Dashboard and Explorer Identifier ID

  • repeatIdentifierOp
  • Applicable Resources: Dashboard, Explorer
  • Allowed Values: check / skip / recover

5.3 Three Conflict Groups for Dashboard and Explorer**

Dashboards and Explorers check both name and identifier ID simultaneously, returning results grouped into the following three categories:

  • name_and_identifier: Both name and identifier ID conflict.
  • 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 skip and recover take effect on a per-group basis.

5.4 Handling Duplicate Names for Other New 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 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 Notes

During import, if the archive contains special data that is currently unsupported or has been marked for ignoring, the system will skip or fail the processing according to the current implementation rules. Please refer to the task status interface response for the actual results.

Request Example

curl 'https://openapi.guance.com/api/v1/workspace/resource/upload' \
-H 'DF-API-KEY: <DF-API-KEY>' \
-F 'files=@guance.com' \
-F 'repeatNameOp=check' \
-F 'repeatIdentifierOp=check' \
--compressed

Response

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

Feedback

Is this page helpful? ×