Skip to content

Create



POST /api/v1/dashboards/create

Overview

Create a dashboard and return its resource identifier. Initialization from a template is supported.

Prerequisites and Usage Steps

Submit a name to create an empty dashboard. To reuse a layout, obtain the template content from Export Dashboard and populate templateInfo. After creation succeeds, save content.uuid. If the name or custom identifier conflicts, the default response is HTTP 200 with content.repeatInfo; clients should check whether creation actually occurred. recoverIdentifier=true deletes the matched old dashboard first, then attempts creation. Before execution, export a backup and verify the UUID of each conflicting object; if it fails, query the current state.

Request Headers

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

Request Body Parameters

Parameter Type Required Description
name string Y Dashboard display name.
Null allowed: False
Maximum length: 128
Example: 生产巡检
How to obtain or enter: Use a name that is not used by another dashboard in the current Workspace.
desc string Description at creation time.
Null allowed: False
Empty string allowed: True
Maximum length: 2048
Example: 生产服务巡检指标
How to obtain or enter: Enter the dashboard purpose. When using a template, omit this field or pass an empty value to use the template's summary.
recoverIdentifier boolean Default false; returns conflict details. true deletes the conflicting object first.
Null allowed: False
Example: false
How to obtain or enter: Keep false for the first submission. After receiving repeatInfo, set true only after confirming that the matched dashboard should be deleted.
identifier string Custom identifier ID, up to 128 characters. This value and UUID are used separately.
Null allowed: False
Empty string allowed: True
Maximum length: 128
Example: prod-check
How to obtain or enter: Choose an identifier according to the caller's naming rules that is not used by another dashboard in this Workspace.
extend json Dashboard extension configuration. Reuse existing fields as needed.
Null allowed: False
Example: {}
How to obtain or enter: Obtain the existing object from content.extend in the dashboard details.
mapping array Field mapping array for dashboard variables. Pass an empty array when there is no mapping.
Null allowed: False
Example: []
How to obtain or enter: Take values from content.mapping of an existing dashboard or content.dashboardMapping in the exported template.
tagNames array Array of scene tag names. When empty, the template's tagInfo may still be used. To create a dashboard without tags, also clear the associated tags in the template.
Null allowed: False
Example: ["team:ops"]
How to obtain or enter: Copy from content.tagInfo[].name in the dashboard details, or enter the names of the tags to associate.
templateInfo json Dashboard template object. main.charts, main.vars, and main.groups define the content.
Null allowed: False
Empty string allowed: False
Example: {"title": "生产巡检", "summary": "生产服务巡检指标", "identifier": "prod-check", "dashboardType": "CUSTOM", "dashboardExtend": {}, "dashboardMapping": [], "iconSet": {}, "dashboardBindSet": [], "main": {"type": "template", "charts": [], "vars": [], "chartGroupPos": [], "groups": []}}
How to obtain or enter: Call Export Dashboard and use the content object in the actual response. After importing across Workspaces, verify variables, data sources, and authorization.
specifyDashboardUUID string Optional UUID for the new dashboard. The full pattern is dsbd_custom_ followed by 32 lowercase alphanumeric characters.
Null allowed: False
Empty string allowed: False
$matchRegExp: ^dsbd_custom_[a-z0-9]{32}$
Example: dsbd_custom_1234567890abcdef1234567890abcdef
How to obtain or enter: Generate 32 lowercase alphanumeric characters on the client and concatenate them with dsbd_custom_. Be sure to confirm that it has not been used.
isPublic int 1 for public, 0 for visible only to the creating identity, and -1 for custom permissions. Defaults to 1 when omitted during creation.
Null allowed: False
Example: 1
How to obtain or enter: Choose 1, 0, or -1 based on the target visibility scope.
openPermissionSet boolean Legacy compatibility field. In current creation handling, isPublic determines whether custom permissions are enabled.
Null allowed: False
Example: false
How to obtain or enter: For compatibility with old clients. New configurations use isPublic=-1.
permissionSet array List of operation permission principals used when isPublic=-1. It can contain role (except owner), member, and team UUIDs.
Null allowed: False
Example: ["role_example"]
How to obtain or enter: Obtain UUIDs from Role List, Member List, or Team List.
readPermissionSet array List of read permission principals used when isPublic=-1. It can contain role (except owner), member, and team UUIDs.
Null allowed: False
Example: ["role_example"]
How to obtain or enter: Obtain UUIDs from Role List, Member List, or Team List.

Additional Parameter Notes

Dashboard templates use the content from the export API. You can reuse main.charts, main.vars, and main.groups directly; when working across Workspaces, verify data sources again.

Template Field How to Fill In
title, summary, identifier Template title, summary, and custom identifier. During 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. During import, only non-empty template values override the current values.
dashboardType, dashboardExtend, dashboardMapping Dashboard type, extension object, and variable mapping. A non-empty template uses the extension and mapping from the template.
iconSet Icon configuration object. You can reuse the exported content as-is, including existing url and icon.
main.vars Variable definition array. Variables are created in submission order.
main.vars[].name, code Variable display name and the key referenced in queries. Copy them from the same exported template to prevent existing queries from losing their references. When omitted, they default to 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 {} when omitted.
main.vars[].multiple, includeStar Control whether multiple selection is supported and whether the wildcard option is included, respectively. Defaults to true.
main.vars[].hide, isHiddenAsterisk Control the hidden state of the variable and wildcard option. Defaults to 0.
main.vars[].valueSort, extend Optional value sorting and extension configuration. Reuse the exported template; when omitted, they default to an empty string and an empty object, respectively.
main.groups Chart group array. You can use name strings or objects containing name and optional extend. A group with the same name is created only once.
main.charts Chart definition array. Old chart UUIDs are ignored during import, and charts are recreated.
main.charts[].name, type Chart name and chart type. The name can contain up to 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 default to [] and {}, respectively.
main.charts[].pos Chart layout object. You can reuse i, x, y, w, and h from the exported item.
main.charts[].group Chart group name string, or an object containing name; the name corresponds to a name in main.groups.

When creating an empty dashboard, you can use the top-level extend and mapping. Permissions are determined by the top-level isPublic and the principal lists. Prefer the top-level tagNames; if it is not provided or is empty, the template's tagInfo can also be used.

Request Example

curl --request POST 'https://openapi.guance.com/api/v1/dashboards/create' \
  -H 'DF-API-KEY: <DF-API-KEY>' \
  -H 'Content-Type: application/json' \
  --data-raw '{"name":"生产巡检","desc":"生产服务巡检指标","identifier":"prod-check","isPublic":1}'

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 to which the dashboard belongs.
content.name string Dashboard display name.
content.desc string Dashboard description.
content.identifier string External custom identifier. Can be empty.
content.ownerType string Owner resource type; usually node for dashboards.
content.type string Dashboard type, for example CUSTOM.
content.chartPos array<object> Chart layout array. For 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> Order of chart group identifiers.
content.iconSet object Icon settings.
content.isPublic integer 1 public, 0 visible only to the creating identity, -1 custom permissions.
content.extend object Extension configuration.
content.mapping array<object> Variable field mapping.
content.createdWay string Resource creation source.
content.dashboardBindSet array View binding configuration.
content.openPermissionSet boolean Whether custom permissions are currently enabled.
content.permissionSet array<string> List of operation permission principal UUIDs.
content.readPermissionSet array<string> List of read permission principal UUIDs.
content.tagInfo array<object> Tag information related to this response.
content.tagInfo[].id string Tag identifier, same as uuid.
content.tagInfo[].uuid string Tag UUID.
content.tagInfo[].name string Associated tag name.
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 included when tag authorization exists.
content.status integer Record status.
content.creator string Creator identity ID.
content.updator string Identity ID of the most recent updater; may be empty if no update has occurred.
content.createAt number Creation time, Unix seconds.
content.updateAt number Most recent update time, Unix seconds. Can be -1 if no update has occurred.
content.deleteAt number Deletion time, Unix seconds. -1 if not deleted.
content.declaration object or null Public declaration of the Workspace.
content.repeatInfo object Returned when a conflict is handled by default. Grouped by name conflicts, identifier conflicts, and simultaneous conflicts. This response does not include a new UUID.
content.repeatInfo.name_and_identifier array<object> Conflict items where both the name and identifier match.
content.repeatInfo.name array<object> Name conflict items.
content.repeatInfo.identifier array<object> Identifier conflict items.
content.repeatInfo.*[].conflictUUIDs array<string> All old dashboard UUIDs involved in this conflict item.
content.repeatInfo.*[].isCrossConflict boolean Whether the name and identifier each matched two different objects.
{
  "code": 200,
  "content": {
    "id": 21,
    "uuid": "dsbd_example",
    "name": "生产巡检",
    "desc": "生产服务巡检指标",
    "workspaceUUID": "wksp_example",
    "identifier": "prod-check",
    "ownerType": "node",
    "type": "CUSTOM",
    "chartPos": [],
    "chartGroupPos": [],
    "iconSet": {},
    "isPublic": 1,
    "extend": {},
    "mapping": [],
    "createdWay": "manual",
    "dashboardBindSet": [],
    "openPermissionSet": false,
    "permissionSet": [],
    "readPermissionSet": [],
    "tagInfo": [],
    "creator": "wsak_example",
    "updator": "",
    "createAt": 1785427200,
    "updateAt": -1,
    "deleteAt": -1,
    "status": 0,
    "declaration": {}
  },
  "errorCode": "",
  "message": "",
  "success": true,
  "traceId": "TRACE-EXAMPLE"
}

HTTP 200 response when both name and identifier conflict

{
  "code": 200,
  "content": {
    "repeatInfo": {
      "name_and_identifier": [
        {
          "name": "生产巡检",
          "identifier": "prod-check",
          "fileName": "",
          "importName": "生产巡检",
          "importIdentifier": "prod-check",
          "existName": "生产巡检",
          "existIdentifier": "prod-check",
          "nameConflictUUID": "dsbd_example",
          "identifierConflictUUID": "dsbd_example",
          "existNameIdentifier": "prod-check",
          "existIdentifierName": "生产巡检",
          "isCrossConflict": false,
          "conflictUUIDs": [
            "dsbd_example"
          ]
        }
      ],
      "name": [],
      "identifier": []
    },
    "declaration": {}
  },
  "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 Format error in part of the JSON file Place the parameters in a JSON object.
400 ft.IdentificationIdExists The specified new UUID is already in use Identifier ID already exists Choose a new UUID that is not yet in use, or omit this field and let the service assign one.
403 ft.ForbiddenDashboardOperation The calling identity cannot operate the target dashboard You do not have permission to operate dashboard [{}] Check the dashboard's 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 upper limit ({}), and new resources cannot be created. Subscribe to the Commercial Plan to unlock the limit Check the Workspace quota, adjust it according to the current quantity and target operation, and then retry.
400 ft.TagScopeMismatch The tag name already exists, but its scope is incompatible with the scene tag The message includes the tag name and scope, for example team:ops: ['monitor'] -> scene. Choose a tag name with a scene or general scope, or use a different name.
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 recheck the template.
406 ft.InvalidParameter The specified UUID is not recognized by the operations portal Parameter {} is invalid Use dsbd_custom_ followed by 32 lowercase alphanumeric characters, or omit it to let the system generate one.
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 in this version.

Feedback

Is this page helpful?