Create¶
POST /api/v1/dashboard/add
Overview¶
Create a user inner dashboard. Supports a blank template, copying a source dashboard, or submitting a custom template.
Before Calling and Usage Steps¶
The simplest request requires only name. When copying, select a valid source dashboard in the same workspace from the Inner Dashboard List. If sourceDashboardUUID is non-empty, it takes precedence; an invalid source may create a blank dashboard. If the name or identifier conflicts, the default HTTP 200 response returns repeatInfo and the dashboard is not created. recoverIdentifier=true deletes all matching dashboards and recreates them; deletion and recreation are handled in the same transaction. If the name and identifier match different dashboards, both may be deleted. Back up first and verify the conflicting UUIDs; after a failure, check the current state and restore from the backup.
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 permission for this operation from API Key Management in the target workspace. |
Body Request Parameters¶
| Parameter | Type | Required | Description |
|---|---|---|---|
| dashboardBidding.* | array | The property value is a match condition array for the corresponding field. Example: [{"op": "in", "value": ["web-01"]}]How to obtain or enter: Use Inner Dashboard Details to read the current binding, or confirm field values from logs, objects, or other data that need to jump to the dashboard. |
|
| dashboardBidding.*[].op | string | in matches one of the given values; wildcard matches by wildcard pattern. When the source field value is non-empty, a standalone * can match all values. Multiple conditions are treated as any match. Example: inHow to obtain or enter: Prefer to reuse the matching method for the field in the details. |
|
| dashboardBidding.*[].value | array | String array. If the workspace restricts leading wildcards, avoid the *example form. Example: ["web-01"]How to obtain or enter: Select actual values from the field in the raw data. To match labels, use label; to match df_label in the raw data. |
|
| sourceDashboardUUID | string | Source dashboard UUID. When non-empty, it takes precedence over templateInfos. Allows null: False Allows empty string: True Maximum length: 128 Example: dsbd_inner_exampleHow to obtain or enter: Get the source UUID to copy from Inner Dashboard List, and verify the details first. |
|
| name | string | Y | Inner dashboard name, up to 256 characters. Allows null: False Maximum length: 256 Example: 主机详情内置视图How to obtain or enter: Enter a name that is not used by another inner dashboard in the current workspace. |
| desc | string | Inner dashboard description, up to 2048 characters. Allows null: False Maximum length: 2048 Example: 根据主机查看运行状态How to obtain or enter: Enter the purpose of the dashboard. |
|
| recoverIdentifier | boolean | Whether to delete matching old dashboards and continue creating. Default false. Allows null: False Example: falseHow to obtain or enter: Keep false for the first request. Set it to true only after backing up and confirming that each conflicting object is to be replaced. |
|
| identifier | string | The inner dashboard identifier must be unique within the same workspace, up to 128 characters, and can be empty. Allows null: False Allows empty string: True Maximum length: 128 Example: host-overviewHow to obtain or enter: Customize a stable identifier. Before modifying it, get the current identifier from the details. |
|
| templateInfos | json | JSON template object used for creation. Allows null: False Allows empty string: False Example: {"title": "主机详情内置视图", "summary": "根据主机查看运行状态", "identifier": "", "dashboardType": "CUSTOM", "dashboardExtend": {}, "dashboardMapping": [], "dashboardBindSet": [], "iconSet": {}, "main": {"type": "template", "charts": [], "vars": [], "groups": [], "chartGroupPos": []}}How to obtain or enter: Get it from content of Export Inner Dashboard, and retain the complete main. |
|
| dashboardBidding | json | Optional binding condition object. Omit it or use an empty object when there is no binding. Allows null: False Example: {"host": [{"op": "in", "value": ["web-01"]}]}How to obtain or enter: Use Inner Dashboard Details to read the current binding, or confirm field values from logs, objects, or other data that need to jump to the dashboard. |
|
| specifyDashboardUUID | string | UUID of the new dashboard. It must start with dsbd_custom_ and be globally unused. Deleted UUIDs cannot be reused. Allows null: False Allows empty string: False $matchRegExp: ^dsbd_custom_[a-z0-9]{32}$ Example: dsbd_custom_0123456789abcdef0123456789abcdefHow to obtain or enter: Generate 32 lowercase letters or digits as the suffix yourself. Usually omitted and assigned by the service. |
Additional Parameter Notes¶
When a template is used, the top-level name is still required. If identifier is omitted, it is empty. Template fields with the same name do not replace top-level fields. If top-level desc is empty or omitted, it is supplemented by the template summary. Only when there is a non-empty binding does the create response include dashboardBidding. When migrating across workspaces, configure the binding separately.
Request Example¶
curl --request POST 'https://openapi.guance.com/api/v1/dashboard/add' \
-H 'DF-API-KEY: <DF-API-KEY>' \
-H 'Content-Type: application/json' \
--data-raw '{"name":"主机详情内置视图","desc":"根据主机查看运行状态","identifier":"host-overview","dashboardBidding":{"host":[{"op":"in","value":["web-01"]}]}}'
Response¶
HTTP 200, application/json. The example below shows the main fields that can be read directly.
| Field | Type | Description |
|---|---|---|
| content.id | integer | Inner dashboard record ID. |
| content.uuid | string | Inner dashboard UUID. |
| content.workspaceUUID | string | Workspace it belongs to. |
| content.name | string | Inner dashboard name. |
| content.desc | string | Inner dashboard description. |
| content.identifier | string | Custom identifier; can be empty. |
| content.ownerType | string | Inner dashboard resource ownership; for inner dashboards, this is inner. |
| content.type | string | Inner dashboard type, for example CUSTOM. |
| content.isPublic | integer | Details access scope. 1 is public; 0 means accessible only to the creating identity. |
| content.chartPos | array<object> |
Chart layout array, containing chartUUID and 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> |
Chart group order. |
| content.iconSet | object | Icon configuration. |
| content.extend | object | Inner dashboard extension information. |
| content.mapping | array<object> |
Variable field mapping information. |
| content.dashboardBindSet | array | Dashboard binding configuration. |
| content.createdWay | string | Resource creation source. |
| content.openPermissionSet | boolean | Permission configuration switch for the entity record. |
| content.permissionSet | array<string> |
UUIDs of operation permission principals in the record. |
| content.readPermissionSet | array<string> |
UUIDs of read permission principals in the record. |
| content.status | integer | Record status. |
| content.creator | string | Creator identity ID. |
| content.updator | string | Most recent updater identity ID; can be empty. |
| content.createAt | number | Creation time, Unix seconds. |
| content.updateAt | number | Update time, Unix seconds. Can be -1 if not updated. |
| content.deleteAt | number | Deletion time, Unix seconds. -1 if not deleted. |
| content.dashboardBidding | object | This field is returned only for a non-empty binding. |
| content.dashboardBidding.* | array<object> |
Match condition array organized by actual source field. |
| content.dashboardBidding.*[].op | string | Match operator. |
| content.dashboardBidding.*[].value | array<string> |
Match value array. |
| content.declaration | object or null | Public declaration of the workspace. |
| content.repeatInfo | object | Returned when the name or identifier conflicts; the response does not contain a new UUID. |
| content.repeatInfo.name | array<object> |
Conflict records matching the name. |
| content.repeatInfo.identifier | array<object> |
Conflict records matching the identifier. |
| content.repeatInfo.name_and_identifier | array<object> |
Conflict records matching both name and identifier. |
| content.repeatInfo.*[].name | string | Name of the dashboard to be created. |
| content.repeatInfo.*[].identifier | string | Identifier of the dashboard to be created. |
| content.repeatInfo.*[].importName | string | Name of the dashboard to be created. |
| content.repeatInfo.*[].importIdentifier | string | Identifier of the dashboard to be created. |
| content.repeatInfo.*[].fileName | string | Associated template file name; usually empty when called directly. |
| content.repeatInfo.*[].existName | string | Name of the matched original dashboard. |
| content.repeatInfo.*[].existIdentifier | string | Identifier of the matched original dashboard. |
| content.repeatInfo.*[].nameConflictUUID | string | UUID of the corresponding original dashboard when a name conflict exists. |
| content.repeatInfo.*[].identifierConflictUUID | string | UUID of the corresponding original dashboard when an identifier conflict exists. |
| content.repeatInfo.*[].existNameIdentifier | string | Identifier of the name-conflict object. |
| content.repeatInfo.*[].existIdentifierName | string | Name of the identifier-conflict object. |
| content.repeatInfo.*[].isCrossConflict | boolean | Whether the name and identifier match two different objects respectively. |
| content.repeatInfo.*[].conflictUUIDs | array<string> |
All original dashboard UUIDs involved in the conflict. |
{
"code": 200,
"content": {
"id": 72,
"uuid": "dsbd_inner_example",
"name": "主机详情内置视图",
"desc": "根据主机查看运行状态",
"workspaceUUID": "wksp_example",
"identifier": "host-overview",
"ownerType": "inner",
"type": "CUSTOM",
"isPublic": 1,
"chartPos": [],
"chartGroupPos": [],
"iconSet": {},
"extend": {},
"mapping": [],
"dashboardBindSet": [],
"createdWay": "manual",
"openPermissionSet": false,
"permissionSet": [],
"readPermissionSet": [],
"status": 0,
"creator": "wsak_example",
"updator": "",
"createAt": 1785427200,
"updateAt": -1,
"deleteAt": -1,
"dashboardBidding": {
"host": [
{
"op": "in",
"value": [
"web-01"
]
}
]
},
"declaration": {}
},
"errorCode": "",
"message": "",
"success": true,
"traceId": "TRACE-EXAMPLE"
}
HTTP 200 response when the name conflicts
{
"code": 200,
"content": {
"repeatInfo": {
"name": [
{
"name": "主机详情内置视图",
"identifier": "",
"fileName": "",
"importName": "主机详情内置视图",
"importIdentifier": "",
"existName": "主机详情内置视图",
"existIdentifier": "host-overview",
"nameConflictUUID": "dsbd_inner_example",
"existNameIdentifier": "host-overview",
"isCrossConflict": false,
"conflictUUIDs": [
"dsbd_inner_example"
]
}
],
"identifier": [],
"name_and_identifier": []
},
"declaration": {}
},
"errorCode": "",
"message": "",
"success": true,
"traceId": "TRACE-EXAMPLE"
}
Error Response¶
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 | Request fields are missing, or field values violate the declared validation conditions | Parameter parsing failed | Check the parameter location, field name, type, and value. |
| 400 | ft.RequestJsonFormatError | Request JSON syntax is invalid | Request JSON format error | Correct the JSON according to content.reason, line, and column. |
| 400 | ft.JsonFormatError | The JSON top level is not an object | Some JSON file format error | Put the fields into a single JSON object. |
| 403 | ft.ForbiddenFreeEditionLimit | The inner dashboard quantity limit is enabled and the workspace has reached the creation limit | Free Plan workspace {} has reached the limit ({}), and new dashboards cannot be created. Upgrade to the Commercial Plan to unlock the limit | Check the current workspace quota, release dashboards that do not need to be retained, and try again. |
| 406 | ft.ParameterCheckFailed | The workspace restricts leading wildcards and the binding value matches a wildcard condition starting with * | Fuzzy matching with a leading * is not supported in query configurations | Remove the leading * from the value or use an exact value. This restriction applies to wildcard conditions or conditions whose field name starts with * or -*. A standalone * does not trigger this validation. The content of the error response is true. |
| 400 | ft.IdentificationIdExists | The inner dashboard identifier or new dashboard UUID is already in use | Identifier ID already exists | Use a value that is not in use, or omit the custom UUID and let the service generate it. |
| 406 | ft.ExceedMaxCharacterLimit | A template chart or dashboard group name exceeds 256 characters | {} exceeds the maximum character length limit | Shorten the corresponding template field. |
| 406 | ft.InvalidParameter | The template structure is invalid, for example main is not an object, charts, vars, or groups are not arrays, 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. |