Skip to content

Create



POST /api/v1/dashboard/add

Overview

Create a single user view.

Body Request Parameters

Parameter Name Type Required Description
sourceDashboardUUID string Source view UUID
Allow null: False
Allow empty string: True
Max length: 128
name string Y View name
Allow null: False
Max length: 256
desc string Description
Example: Description1
Allow null: False
Max length: 2048
recoverIdentifier boolean Whether to overwrite duplicate identifier id/name related objects. false - only return duplicate groups, true - delete related objects in duplicate groups and continue creation.
Allow null: False
identifier string Identifier id --Added identifier id on 2024.12.25
Example: xxxx
Allow null: False
Allow empty string: True
Max length: 128
templateInfos json Custom template data
Example: {}
Allow null: False
Allow empty string: False
dashboardBidding json mapping, default is {}
Example: {}
Allow null: False
specifyDashboardUUID string Specify the UUID of the new dashboard, must start with dsbd_custom_ followed by 32 lowercase alphanumeric characters.
Example: dsbd_custom_xxxx32
Allow null: False
Allow empty string: False
$matchRegExp: ^dsbd_custom_[a-z0-9]{32}$

Parameter Supplementary Notes

1. Interface Behavior

The interface first checks for conflicts with the name and identifier ID of the view to be created. Conflict results are returned in the following three categories:

  • name_and_identifier: Both name and identifier ID are duplicate.
  • identifier: Only the identifier ID is duplicate.
  • name: Only the name is duplicate.

When recoverIdentifier=false or not provided: - Does not create the view. - Directly returns repeatInfo.

When recoverIdentifier=true: - Deletes the related views found in the duplicate groups mentioned above. - Then proceeds to create the new view.


2. Response Examples

2.1 Creation successful

{
  "uuid": "dsbd_xxxx32",
  "name": "001Bind Built-in View"
}

2.2 Duplicates exist, returns duplicate groups

{
  "repeatInfo": {
    "name_and_identifier": [
      {
        "name": "System Overview",
        "identifier": "system_overview",
        "importName": "System Overview",
        "importIdentifier": "system_overview",
        "existName": "System Overview",
        "existIdentifier": "system_overview",
        "conflictUUIDs": ["dsbd_xxxx01"]
      }
    ],
    "identifier": [],
    "name": []
  }
}

3. Request Body Structure Explanation

Request Body Structure Explanation

Parameter Name type Description
name string Name
desc string Description
identifier string Identifier id --Added on 2024.12.25
recoverIdentifier boolean Whether to delete related views in duplicate groups and continue creation.
dashboardBidding dict Dashboard binding information.
sourceDashboardUUID string UUID of the cloned dashboard or built-in user view.
templateInfos dict Template information for cloning built-in system views.

Explanation of the dashboardBidding field for binding built-in views

Internally supports op values: in/wildcard.

dashboardBidding field example:

{
    "service": [
        {
            "value": [
                "*"
            ],
            "op": "in"
        }
    ],
    "app_id": [
        {
            "value": [
                "test0"
            ],
            "op": "wildcard"
        }
    ],
    "label": [
        {
            "value": [
                "Do Not Delete"
            ],
            "op": "in"
        }
    ]
}

Request Example

curl 'https://openapi.guance.com/api/v1/dashboard/add' \
-H 'DF-API-KEY: <DF-API-KEY>' \
-H 'Accept-Language: zh' \
-H 'Content-Type: application/json;charset=UTF-8' \
-H 'Accept: application/json, text/plain, */*' \
--data-raw '{"name":"001Bind Built-in View","dashboardBidding":{"service":[{"value":["*"],"op":"in"}],"app_id":[{"value":["test0"],"op":"wildcard"}],"label":[{"value":["Do Not Delete"],"op":"in"}]}}' \
--compressed

Response

{
    "code": 200,
    "content": {
        "chartGroupPos": [],
        "chartPos": [],
        "createAt": 1713513331,
        "createdWay": "manual",
        "creator": "wsak_xxxx32",
        "identifier": "",
        "dashboardBidding": {
            "app_id": [
                {
                    "op": "wildcard",
                    "value": [
                        "test0"
                    ]
                }
            ],
            "label": [
                {
                    "op": "in",
                    "value": [
                        "Do Not Delete"
                    ]
                }
            ],
            "service": [
                {
                    "op": "in",
                    "value": [
                        "*"
                    ]
                }
            ]
        },
        "dashboardBindSet": [],
        "declaration": {
            "b": [
                "asfawfgajfasfafgafwba",
                "asfgahjfaf"
            ],
            "business": "aaa",
            "organization": "64fe7b4062f74d0007b46676"
        },
        "deleteAt": -1,
        "desc": "",
        "extend": {},
        "iconSet": {},
        "id": 5091,
        "isPublic": 1,
        "mapping": [],
        "name": "001Bind Built-in View",
        "ownerType": "inner",
        "status": 0,
        "type": "CUSTOM",
        "updateAt": 1713513331,
        "updator": "wsak_xxxx32",
        "uuid": "dsbd_xxxx32",
        "workspaceUUID": "wksp_xxxx32"
    },
    "errorCode": "",
    "message": "",
    "success": true,
    "traceId": "TRACE-2FB0228E-1660-4557-AF7B-688176108C28"
}

Feedback

Is this page helpful? ×