Export¶
GET /api/v1/viewer/{viewer_uuid}/export
Overview¶
Export the specified Explorer as a JSON template.
Before Calling and Usage Steps¶
Get the UUID from the Explorer List. Save the response content for Explorer creation or import. Export removes the default query space and target site configuration. External data source names or identifiers may need to be rebound to the target workspace. Template content preserves the chart, variable, and group structure.
Route Parameters¶
| Parameter | Type | Required | Description |
|---|---|---|---|
| viewer_uuid | string | Y | UUID of the target Explorer in the current workspace. Example: dsbd_view_exampleHow to get or enter: Obtain it from content.data[].uuid in the Explorer List, or use content.uuid from the creation response. |
Request Headers¶
| Parameter | Type | Required | Description |
|---|---|---|---|
| DF-API-KEY | string | Y | OpenAPI authentication credential for the workspace. Example: <DF-API-KEY>How to get or enter: Obtain an OpenAPI Key with the required permissions from API Key Management in the target workspace. |
Query Request Parameters¶
| Parameter | Type | Required | Description |
|---|---|---|---|
| title | string | Optional. Overrides the export title. Example: 主机巡检模板How to get or enter: Enter a title used only for the exported template. |
Additional Parameter Notes¶
The content of a successful response is portable template data.
Request Example¶
curl --get 'https://openapi.guance.com/api/v1/viewer/dsbd_view_example/export' \
-H 'DF-API-KEY: <DF-API-KEY>'
Response¶
HTTP 200, application/json. The example below shows the main fields that can be read directly.
| Field | Type | Description |
|---|---|---|
| content.title | string | Template name; the title Query can be used only to override the export result. |
| content.summary | string | Template description. |
| content.identifier | string | Custom identifier. |
| content.dashboardType | string | Saved Explorer type. |
| content.dashboardOwnerType | string | Ownership of the source view resource. |
| content.dashboardExtend | object | Portable extension configuration. |
| content.dashboardMapping | array<object> |
Variable field mappings. |
| content.dashboardBindSet | array | View binding configuration. |
| content.iconSet | object | Icon configuration. |
| content.thumbnail | string | Thumbnail field. |
| content.tagInfo | array<object> |
Tags associated with the template. |
| content.tagInfo[].name | string | Template tag name. |
| content.main | object | Charts, variables, and groups in the template. |
| content.main.type | string | Fixed as template. |
| content.main.vars | array<object> |
Array of variable definitions. |
| content.main.vars[].name | string | Variable name. |
| content.main.vars[].type | string | Variable type. |
| content.main.vars[].definition | object | Variable definition; the content varies by type. |
| content.main.vars[].seq | integer | Variable order. |
| content.main.vars[].code | string | Variable code, used to reference the variable. |
| content.main.vars[].datasource | string | Data source of the variable. |
| content.main.vars[].valueSort | string | Sorting method for variable values. |
| content.main.vars[].hide | integer | Setting for hiding the variable. |
| content.main.vars[].isHiddenAsterisk | integer | Setting for the hidden asterisk option. |
| content.main.vars[].multiple | boolean | Whether multiple selection is allowed. |
| content.main.vars[].includeStar | boolean | Whether to include the asterisk option. |
| content.main.vars[].extend | object | Extended settings for the variable. |
| content.main.charts | array<object> |
Array of chart definitions. Import recreates chart UUIDs. |
| content.main.charts[].uuid | string | Source chart UUID. |
| content.main.charts[].name | string | Chart name. |
| content.main.charts[].type | string | Chart type. |
| content.main.charts[].chartGroupUUID | string | Source chart group UUID. |
| content.main.charts[].group.name | string or null | Chart group name. |
| content.main.charts[].prevGroupName | string or null | Previous chart group name. |
| content.main.charts[].pos | object | Position and size of the chart in the layout. |
| content.main.charts[].queries | array<object> |
Chart query configuration. |
| content.main.charts[].extend | object | Chart display and interaction configuration. |
| content.main.groups | array<object> |
Array of group definitions. |
| content.main.groups[].name | string | Chart group name. |
| content.main.groups[].extend | object | Extended chart group configuration. |
| content.main.chartGroupPos | array<string> |
Chart group sort identifiers. |
| content.declaration | object or null | Common declaration of the workspace. |
{
"code": 200,
"content": {
"title": "主机巡检查看器",
"summary": "主机巡检与状态核对",
"identifier": "",
"dashboardType": "CUSTOM",
"dashboardExtend": {},
"dashboardMapping": [],
"dashboardBindSet": [],
"iconSet": {},
"main": {
"type": "template",
"charts": [],
"vars": [],
"groups": [],
"chartGroupPos": []
},
"dashboardOwnerType": "viewer",
"thumbnail": "",
"tagInfo": [],
"declaration": {}
},
"errorCode": "",
"message": "",
"success": true,
"traceId": "TRACE-EXAMPLE"
}
Error Response¶
For authentication, rate limiting, and common request errors, see Common Error Definitions.
When the target does not exist, an empty object may be returned successfully; if title is provided, the response may contain only the template title and common fields. Check whether main is returned before saving and importing.
| HTTP Status | errorCode | Trigger Condition | Message or Response Description | Handling |
|---|---|---|---|---|
| 406 | ft.InvalidParameter | The historical chart query structure is invalid and cannot be exported as a valid template | Parameter {} is invalid |
Check the original view's chart configuration against the field path in the error, correct it, and export again. |