Import¶
POST /api/v1/viewer/{viewer_uuid}/import
Overview¶
Overwrite the specified Explorer with an existing source view or template.
Prerequisites and Usage Steps¶
First call Export Explorer to back up the target. Choose an import template or reference a source view that is confirmed to exist in the current workspace. If you submit sourceDashboardUUID, the template is generated from that source view. An empty string or an invalid source may cause the export to be empty while the target is still overwritten, so be sure to verify before submitting. The target UUID is retained. Existing charts, groups, and variables are deleted first, and then recreated according to the template. templateInfo={} or omitting main clears these existing contents. The example uses a blank template; for actual migration, pass a complete template. The template is validated first, and deletion and recreation are completed in the same transaction. If an error occurs, first verify the current content and backup, and then decide whether to restore.
Path Parameters¶
| Parameter Name | Type | Required | Description |
|---|---|---|---|
| viewer_uuid | string | Y | UUID of the target Explorer in the current workspace. Example: dsbd_view_exampleHow to obtain or specify: Obtain it from content.data[].uuid in the Explorer List, or use content.uuid from the create response. |
Request Headers¶
| Parameter Name | Type | Required | Description |
|---|---|---|---|
| DF-API-KEY | string | Y | OpenAPI authentication credential for the workspace. Example: <DF-API-KEY>How to obtain or specify: Obtain an OpenAPI Key with the permission for this operation from API Key management in the target workspace. |
Body Request Parameters¶
| Parameter Name | Type | Required | Description |
|---|---|---|---|
| ownerType | string | Resource ownership after import. Default: viewer. Null allowed: False Example: viewerHow to obtain or specify: Omit this field or set it to viewer when the resource is used as an Explorer. |
|
| sourceDashboardUUID | string | When this field is provided, the server preferentially exports the template from the source view. Null allowed: False Example: dsbd_source_exampleHow to obtain or specify: Obtain an actual source UUID that is confirmed to be exportable from the Explorer List or Dashboard List. Omit this field when using templateInfo. |
|
| templateInfo | json | Use either this field or the source view. The template object should contain a complete main. Null allowed: False Example: {"title": "Host Inspection Explorer", "summary": "Host inspection and status verification", "identifier": "", "dashboardType": "CUSTOM", "dashboardExtend": {}, "dashboardMapping": [], "dashboardBindSet": [], "iconSet": {}, "main": {"type": "template", "charts": [], "vars": [], "groups": [], "chartGroupPos": []}}How to obtain or specify: First call Export Explorer to obtain the content object. Choose to use it as is or modify the template fields that need adjustment. |
Additional Parameter Notes¶
Import uses a single templateInfo. Dashboard Template Field Descriptions describe the template fields. Non-empty title, summary, identifier, and other fields can overwrite existing properties. If dashboardExtend, dashboardMapping, and dashboardType are omitted, they are treated as an empty object, an empty array, and CUSTOM, respectively.
Request Example¶
curl --request POST 'https://openapi.guance.com/api/v1/viewer/dsbd_view_example/import' \
-H 'DF-API-KEY: <DF-API-KEY>' \
-H 'Content-Type: application/json' \
--data-raw '{"templateInfo":{"title":"Host Inspection Explorer","summary":"Host inspection and status verification","identifier":"","dashboardType":"CUSTOM","dashboardExtend":{},"dashboardMapping":[],"dashboardBindSet":[],"iconSet":{},"main":{"type":"template","charts":[],"vars":[],"groups":[],"chartGroupPos":[]}}}'
Response¶
HTTP 200, application/json. The following example shows the main fields that can be read directly.
| Field | Type | Description |
|---|---|---|
| content.id | integer | Explorer record number. |
| content.uuid | string | Explorer UUID. |
| content.workspaceUUID | string | Workspace to which it belongs. |
| content.name | string | Explorer name. |
| content.desc | string | Explorer description. |
| content.identifier | string | Custom identifier; can be empty. |
| content.ownerType | string | Explorer resource ownership; usually viewer. |
| content.type | string | Explorer type, for example, CUSTOM. |
| content.isPublic | integer | Visibility scope of the current resource. 1 means public; 0 means visible only to the creating identity. |
| content.chartPos | array<object> |
Array of chart layouts, containing chartUUID and the layout object pos. |
| content.chartPos[].chartUUID | string | UUID of the referenced chart. |
| content.chartPos[].pos | object | Position and size of the layout, such as x, y, w, and h. |
| content.chartGroupPos | array<string> |
Order of chart groups. |
| content.iconSet | object | Icon configuration. |
| content.extend | object | Explorer extension information. |
| content.mapping | array<object> |
Variable field mapping information. |
| content.dashboardBindSet | array | View binding configuration. |
| content.createdWay | string | Resource creation source. |
| content.openPermissionSet | boolean | Permission configuration switch for the entity record. |
| content.permissionSet | array<string> |
UUIDs of principals with operation permissions in the record. |
| content.readPermissionSet | array<string> |
UUIDs of principals with read permissions in the record. |
| content.tagInfo | array<object> |
Associated tag information. |
| content.tagInfo[].id | string | Identifier that is the same as the tag UUID. |
| content.tagInfo[].uuid | string | Tag UUID. |
| content.tagInfo[].name | string | Tag name. |
| content.tagInfo[].description | string | Tag description. |
| content.tagInfo[].colour | string | Tag color. |
| content.tagInfo[].scope | array<string> |
Scopes in which the tag takes effect. |
| content.tagInfo[].tagPermissionInfo | object | Read/write authorization information when present. |
| content.status | integer | Record status. |
| content.creator | string | Creator identity ID. |
| content.updator | string | ID of the identity that most recently updated the record; can be empty. |
| content.createAt | number | Creation time in Unix seconds. |
| content.updateAt | number | Update time in Unix seconds. Can be -1 if not updated. |
| content.deleteAt | number | Deletion time in Unix seconds. -1 if not deleted. |
| content.creatorInfo | object | Creator identity information; an empty object if not found. |
| content.updatorInfo | object | Most recent updater identity information; an empty object if not found. |
| content.creatorInfo.uuid | string | May be provided when the corresponding identity is found. Identity identifier. |
| content.creatorInfo.status | integer | May be provided when the corresponding identity is found. Account status. |
| content.creatorInfo.wsAccountStatus | integer | May be provided when the corresponding identity is found. Workspace member status. |
| content.creatorInfo.username | string | May be provided when the corresponding identity is found. Login name. |
| content.creatorInfo.name | string | May be provided when the corresponding identity is found. Display name. |
| content.creatorInfo.iconUrl | string | May be provided when the corresponding identity is found. Avatar URL. |
| content.creatorInfo.email | string | May be provided when the corresponding identity is found. Account email. For an API Key identity, its identifier may be returned. |
| content.creatorInfo.mobile | string | May be provided when the corresponding identity is found. Contact information. |
| content.creatorInfo.countryCode | string | May be provided when the corresponding identity is found. Country or region code of the mobile number. |
| content.creatorInfo.acntWsNickname | string | May be provided when the corresponding identity is found. Nickname in the workspace. |
| content.updatorInfo.uuid | string | May be provided when the corresponding identity is found. Identity identifier. |
| content.updatorInfo.status | integer | May be provided when the corresponding identity is found. Account status. |
| content.updatorInfo.wsAccountStatus | integer | May be provided when the corresponding identity is found. Workspace member status. |
| content.updatorInfo.username | string | May be provided when the corresponding identity is found. Login name. |
| content.updatorInfo.name | string | May be provided when the corresponding identity is found. Display name. |
| content.updatorInfo.iconUrl | string | May be provided when the corresponding identity is found. Avatar URL. |
| content.updatorInfo.email | string | May be provided when the corresponding identity is found. Account email. For an API Key identity, its identifier may be returned. |
| content.updatorInfo.mobile | string | May be provided when the corresponding identity is found. Contact information. |
| content.updatorInfo.countryCode | string | May be provided when the corresponding identity is found. Country or region code of the mobile number. |
| content.updatorInfo.acntWsNickname | string | May be provided when the corresponding identity is found. Nickname in the workspace. |
| content.skippedTags | array<object> |
Tags skipped because their scopes do not match. |
| content.skippedTags[].name | string | Name that was skipped. |
| content.skippedTags[].scope | array<string> |
Existing tag scopes. |
| content.skippedTags[].expectedScope | string | Expected tag scope. |
| content.skippedTags[].reason | string | Reason for skipping. |
| content.skippedTags[].resourceUUID | string | Associated resource UUID when present. |
| content.declaration | object or null | Public declaration of the workspace. |
{
"code": 200,
"content": {
"id": 25,
"uuid": "dsbd_view_example",
"name": "Host Inspection Explorer",
"desc": "Host inspection and status verification",
"workspaceUUID": "wksp_example",
"identifier": "",
"ownerType": "viewer",
"type": "CUSTOM",
"isPublic": 1,
"chartPos": [],
"chartGroupPos": [],
"iconSet": {},
"extend": {},
"mapping": [],
"dashboardBindSet": [],
"createdWay": "import",
"openPermissionSet": false,
"permissionSet": [],
"readPermissionSet": [],
"tagInfo": [],
"status": 0,
"creator": "wsak_example",
"updator": "",
"createAt": 1785427200,
"updateAt": -1,
"deleteAt": -1,
"creatorInfo": {},
"updatorInfo": {},
"declaration": {}
},
"errorCode": "",
"message": "",
"success": true,
"traceId": "TRACE-EXAMPLE"
}
Error Response¶
For authentication, rate limiting, and common request errors, see Common Error Definition.
| HTTP Status | errorCode | Trigger Condition | Message or Response Description | Resolution |
|---|---|---|---|---|
| 406 | ft.ParameterValidationFailed | Field type or value does not conform to the declaration, or an undeclared top-level field is included | Parameter parsing failed | Check the parameter location, field name, type, and value. |
| 400 | ft.RequestJsonFormatError | Invalid request JSON syntax | Request JSON format error | Fix the JSON according to content.reason, line, and column. |
| 400 | ft.JsonFormatError | JSON syntax is valid, but the request top level is not an object | Format error in part of the JSON file | Pass the parameters as a JSON object. |
| 404 | ft.NotFoundView | The target does not exist, has been deleted, or is not in the current workspace | Specified view not found | Use the Explorer List in the same workspace to reconfirm a valid UUID. |
| 403 | ft.ForbiddenFreeEditionLimit | The workspace has enabled a quantity limit and has reached the upper limit | Free Plan workspace {} has reached the upper limit ({}). You cannot create new ones. Subscribe to the Commercial Plan to unlock the limit | Check the current plan and the number of Explorers. |
| 406 | ft.ExceedMaxCharacterLimit | A chart or group name in the template exceeds 256 characters, or a tag name exceeds 128 characters | {} exceeds the maximum character length limit | Modify the template according to the field length limits. |
| 400 | ft.IdentificationIdExists | The template identifier is already used by another view under the target type | Identifier ID already exists | Change the template identifier and try again. |
| 406 | ft.MissingImportTemplateResourceUUID | No source UUID was submitted, and no template was provided | Missing import template/import source view UUID | Pass a verifiable actual source UUID or an exported template object. |
| 406 | ft.InvalidParameter | Invalid template structure. 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 the complete template returned by the export API in this version. |