Skip to content

Import



POST /api/v1/dashboards/{dashboard_uuid}/import

Overview

Overwrite the content of the specified dashboard with a template while keeping the target dashboard UUID.

Before You Call and Usage Steps

First use Export Dashboard to back up the target dashboard and validate the template to be imported. Pass the complete object that contains main. The dashboard UUID is preserved. Existing charts, variables, and groups are removed first and then rebuilt from the template, so charts receive new UUIDs. The template is validated first, and deletion and rebuilding are completed within the same transaction. After a failure, check the details and export the current content first, then restore from the backup.

Route Parameters

Parameter Name Type Required Description
dashboard_uuid string Y UUID of the target dashboard.
Example: dsbd_example
How to obtain or fill in: Copy content.data[].uuid from the Dashboard List, or use content.uuid from the creation result.

Request Headers

Parameter Name Type Required Description
DF-API-KEY string Y OpenAPI authentication credential of the Workspace.
Example: <DF-API-KEY>
How to obtain or fill in: Obtain an OpenAPI Key with the required permission from API Key Management in the target Workspace.

Body Request Parameters

Parameter Name Type Required Description
templateInfo json Y Business-required template object. If omitted, a missing template error is returned; do not probe with an empty object, because an empty object may clear the content.
Allows null: False
Example: {"title": "Production inspection update", "summary": "Production service inspection metrics", "identifier": "prod-check-updated", "dashboardType": "CUSTOM", "dashboardExtend": {}, "dashboardMapping": [], "iconSet": {}, "dashboardBindSet": [], "main": {"type": "template", "charts": [], "vars": [], "chartGroupPos": [], "groups": []}}
How to obtain or fill in: Call Export Dashboard and use the content object from the actual response. After importing across Workspaces, check the variables, data sources, and authorizations.
specifyDashboardUUID string Compatibility field; the current import route does not read this field.
Allows null: False
Allows empty string: False
$matchRegExp: ^dsbd_custom_[a-z0-9]{32}$
Example: dsbd_custom_1234567890abcdef1234567890abcdef
How to obtain or fill in: Use the creation API when you need to define a new UUID. For import, use the target UUID in the path.

Additional Parameter Notes

The dashboard template uses the content from the export API. You can reuse main.charts, main.vars, and main.groups directly; re-verify data sources when working across Workspaces.

Template Field How to Fill In
title, summary, identifier Template title, summary, and custom identifier. On creation, the top-level name and identifier determine the new values; when the top-level desc is empty or omitted, the template summary is used. On import, only non-empty values in the template overwrite the current values.
dashboardType, dashboardExtend, dashboardMapping Dashboard type, extension object, and variable mapping. For non-empty templates, the extension and mapping from the template are used.
iconSet Icon configuration object. You can reuse the exported content as-is, including the existing url and icon.
main.vars Array of variable definitions, created in the submission order.
main.vars[].name, code Variable display name and the key referenced in queries. Copy them from the same exported template to avoid breaking references in existing queries. When omitted, they are empty strings.
main.vars[].type, datasource Variable type and data source. Copy the exported values of variables of the same type. type is converted to uppercase.
main.vars[].definition Variable value configuration. The format varies by variable type; fill it in according to the exported structure of variables of the same type. Defaults to {}.
main.vars[].multiple, includeStar Control whether multiple selection is supported and whether a wildcard option is included, respectively. Default: true.
main.vars[].hide, isHiddenAsterisk Control the hidden state of the variable and the wildcard option. Default: 0.
main.vars[].valueSort, extend Option value sorting and extension configuration. Reuse the exported template; when omitted, they are an empty string and an empty object, respectively.
main.groups Array of chart groups. You can use a name string, or an object containing name and an optional extend. A group with the same name is created only once.
main.charts Array of chart definitions. Old chart UUIDs are ignored on import and the charts are re-created.
main.charts[].name, type Chart name and chart type. The name can be at most 256 characters and defaults to empty. type defaults to line; you can copy the actual type from the export.
main.charts[].queries, extend Query and extension configuration. The internal structure varies by chart type; reuse the exported object of a chart of the same type. When omitted, they are [] and {}, respectively.
main.charts[].pos Chart layout object. You can reuse i, x, y, w, and h from the exported item.
main.charts[].group Group name string, or an object containing name; the name corresponds to a name in main.groups.

Request Example

curl --request POST 'https://openapi.guance.com/api/v1/dashboards/dsbd_example/import' \
  -H 'DF-API-KEY: <DF-API-KEY>' \
  -H 'Content-Type: application/json' \
  --data-raw '{"templateInfo":{"title":"Production inspection update","summary":"Production service inspection metrics","identifier":"prod-check-updated","dashboardType":"CUSTOM","dashboardExtend":{},"dashboardMapping":[],"iconSet":{},"dashboardBindSet":[],"main":{"type":"template","charts":[],"vars":[],"chartGroupPos":[],"groups":[]}}}'

Response

HTTP 200, application/json. The example below shows the main fields that can be read directly.

Field Type Description
content.id integer Dashboard record ID.
content.uuid string Dashboard UUID, used for details, modification, deletion, and carousel.
content.workspaceUUID string Workspace it belongs to.
content.name string Dashboard display name.
content.desc string Dashboard description.
content.identifier string External custom identifier; can be empty.
content.ownerType string Resource type ownership; typically node for dashboards.
content.type string Dashboard type, for example CUSTOM.
content.chartPos array<object> Chart layout array. In each item, chartUUID is the chart identifier and pos is the layout object.
content.chartPos[].chartUUID string UUID of the associated chart.
content.chartPos[].pos object Chart size and position, for example x, y, w, and h.
content.chartGroupPos array<string> Arrangement order of chart group identifiers.
content.iconSet object Icon settings.
content.isPublic integer 1 for public, 0 for visible only to the creating identity, -1 for custom permissions.
content.extend object Extension configuration.
content.mapping array<object> Variable field mapping.
content.createdWay string Source of resource creation.
content.dashboardBindSet array View binding configuration.
content.openPermissionSet boolean Whether custom permissions are currently enabled.
content.permissionSet array<string> List of UUIDs of operation permission subjects.
content.readPermissionSet array<string> List of UUIDs of read permission subjects.
content.tagInfo array<object> Tag information related to this response.
content.tagInfo[].id string Tag identifier, identical to uuid.
content.tagInfo[].uuid string Tag UUID.
content.tagInfo[].name string Name of the associated tag.
content.tagInfo[].description string Tag description.
content.tagInfo[].colour string Tag color.
content.tagInfo[].scope array<string> Effective scope of the tag.
content.tagInfo[].tagPermissionInfo object Operation and read permission information attached when tag authorization exists.
content.status integer Record status.
content.creator string Creator identity ID.
content.updator string Identity ID of the last updater; may be empty when none has occurred.
content.createAt number Creation time, in Unix seconds.
content.updateAt number Last update time, in Unix seconds. May be -1 when none has occurred.
content.deleteAt number Deletion time, in Unix seconds. -1 when not deleted.
content.creatorInfo object Creator information; may be an empty object.
content.updatorInfo object Last updater information; may be an empty object.
content.declaration object or null Public declaration of the Workspace.
content.skippedTags array<object> Returned when some tags are skipped because their scope does not match.
content.skippedTags[].name string Name of the skipped tag.
content.skippedTags[].scope array<string> Existing tag scope.
content.skippedTags[].expectedScope string Tag scope expected by the current resource.
content.skippedTags[].reason string Reason the tag was skipped.
{
  "code": 200,
  "content": {
    "id": 21,
    "uuid": "dsbd_example",
    "name": "Production inspection update",
    "desc": "Production service inspection metrics",
    "workspaceUUID": "wksp_example",
    "identifier": "prod-check-updated",
    "ownerType": "node",
    "type": "CUSTOM",
    "chartPos": [],
    "chartGroupPos": [],
    "iconSet": {},
    "isPublic": 1,
    "extend": {},
    "mapping": [],
    "createdWay": "import",
    "dashboardBindSet": [],
    "openPermissionSet": false,
    "permissionSet": [],
    "readPermissionSet": [],
    "tagInfo": [],
    "creator": "wsak_example",
    "updator": "",
    "createAt": 1785427200,
    "updateAt": -1,
    "deleteAt": -1,
    "status": 0,
    "declaration": {},
    "creatorInfo": {},
    "updatorInfo": {}
  },
  "errorCode": "",
  "message": "",
  "success": true,
  "traceId": "TRACE-EXAMPLE"
}

Error Responses

For authentication, rate limiting, and common request errors, see Common Error Definitions.

HTTP Status errorCode Trigger Condition Message or Response Description Handling
406 ft.ParameterValidationFailed A request field is missing, or a field value violates the declared validation conditions Parameter parsing failed Check the parameter location, field name, type, and value.
400 ft.RequestJsonFormatError The request JSON syntax is invalid Request JSON format error Fix the JSON according to content.reason, line, and column.
400 ft.JsonFormatError The JSON syntax is valid but the request top level is not an object Some JSON file format error Place the parameters inside a JSON object.
404 ft.NotFoundView The target dashboard does not exist, has been deleted, or is not in the current Workspace Specified view not found Use a UUID returned by the dashboard list of the current Workspace instead.
403 ft.ForbiddenDashboardOperation The calling identity cannot operate the target dashboard You do not have operation permission on dashboard [{}] Check the dashboard visibility scope, operation authorization, and the API Key used.
403 ft.ForbiddenFreeEditionLimit The target Workspace has the corresponding quantity limit enabled and the current quantity has reached the upper limit Free Plan Workspace {} has reached the limit ({}), cannot create new ones. Upgrade to Commercial Plan to unlock the limit Check the Workspace quota, adjust according to the existing quantity and target operation, and retry.
400 ft.IdentificationIdExists The template custom identifier is already used by another dashboard of the same kind Identifier ID already exists Change the template identifier and submit again.
406 ft.ExceedMaxCharacterLimit A chart, chart group, or tag name in the template exceeds the field limit {} exceeds the maximum character length limit Shorten chart and group names to 256 characters or fewer and tag names to 128 characters or fewer, then re-check the template.
406 ft.MissingImportTemplateResourceUUID No template object is provided Missing import template/import source view UUID Take the complete content from the export response and put it into templateInfo.
406 ft.InvalidParameter The template structure is invalid, for example main is not an object, charts, vars, or groups is not an array, or the chart query structure is invalid Parameter {} is invalid Modify the template according to the field path indicated in the error. Prefer using the complete template returned by the export API of this version.

Feedback

Is this page helpful?