コンテンツにスキップ

作成



POST /api/v1/dashboards/create

概要

空のダッシュボード、または「ダッシュボードテンプレート」に基づいてダッシュボードを作成します。 ルール

パラメータの name フィールドは、templateInfo 内の title を上書きします。

Body リクエストパラメータ

パラメータ名 必須 説明
name string Y ダッシュボード名
空の場合は許可: False
最大長: 128
desc string 説明
例: 説明1
空の場合は許可: False
空文字列の場合は許可: True
最大長: 2048
recoverIdentifier boolean 重複する識別ID/名関連オブジェクトを上書きするかどうか。false-重複グループのみを返す、true-重複グループ内の関連オブジェクトを削除してから作成を続行
空の場合は許可: False
identifier string 識別 ID --2024.12.25 新規追加の識別 ID
例: xxxx
空の場合は許可: False
空文字列の場合は許可: True
最大長: 128
extend json ダッシュボードの追加データ、デフォルトは{}
例: {}
空の場合は許可: False
mapping array ビュー変数のフィールドマッピング情報、デフォルトは []
例: [{'class': 'host_processes', 'field': 'create_time', 'mapping': 'username', 'datasource': 'object'}]
空の場合は許可: False
tagNames array 関連付けるタグリスト
空の場合は許可: False
templateInfo json ダッシュボードテンプレートデータ
例: {}
空の場合は許可: False
空文字列の場合は許可: False
specifyDashboardUUID string 新規作成するダッシュボードの uuid を指定。プレフィックスは dsbd_custom_ で、その後ろに32桁の小文字英数字を続ける必要があります。
例: dsbd_custom_xxxx32
空の場合は許可: False
空文字列の場合は許可: False
$matchRegExp: ^dsbd_custom_[a-z0-9]{32}$
isPublic int 公開表示するかどうか。1は公開、0は非公開、-1はカスタム
例: 1
空の場合は許可: False
openPermissionSet boolean 2024-11-27 リリース このフィールドは廃止され、効力を持ちません。以降は isPublic を -1 に設定することでカスタム権限設定を有効にします。
空の場合は許可: False
permissionSet array カスタム時(isPublic が -1 の場合)の操作権限設定。設定可能な対象(ロール(所有者を除く)、メンバー uuid、チーム uuid)
例: ['wsAdmin', 'acnt_xxxx', 'group_yyyy']
空の場合は許可: False
readPermissionSet array カスタム時(isPublic が -1 の場合)の読み取り権限設定。設定可能な対象(ロール(所有者を除く)、メンバー uuid、チーム uuid)
例: ['wsAdmin', 'acnt_xxxx', 'group_yyyy']
空の場合は許可: False

パラメータ補足説明

1. インターフェースの動作

インターフェースは、まず作成しようとしているダッシュボードの名前と識別 ID の重複をチェックします。重複の結果は、以下の3つのカテゴリで返されます。

  • name_and_identifier:名前と識別 ID の両方が重複
  • identifier:識別 ID のみ重複
  • name:名前のみ重複

recoverIdentifier=false または未指定の場合: - ダッシュボードは作成されません - 直接 repeatInfo を返します

recoverIdentifier=true の場合: - 上記3つの重複グループでヒットした関連ダッシュボードを削除します - その後、新しいダッシュボードの作成を続行します


2. レスポンス例

2.1 作成成功

{
  "uuid": "dsbd_xxxx32",
  "name": "CPU モニタリングビュー"
}

2.2 重複が存在する場合、重複グループを返す

{
  "repeatInfo": {
    "name_and_identifier": [
      {
        "name": "システム概要",
        "identifier": "system_overview",
        "importName": "システム概要",
        "importIdentifier": "system_overview",
        "existName": "システム概要",
        "existIdentifier": "system_overview",
        "conflictUUIDs": ["dsbd_xxxx01"]
      }
    ],
    "identifier": [],
    "name": []
  }
}

3. パラメータ説明

パラメータ説明:

テンプレートの基本構造構成は、ビュー構造(チャート構造、ビュー変数構造、チャートグループ構造を含む)で構成されます。

templateInfo の本体構造説明

パラメータ名 type 必須 説明
title string 必須 ビュータイトル名
summary string テンプレートの概要情報
identifier string テンプレート識別 ID --2024.12.25 新規追加の識別 ID
dashboardType string 廃止済み、デフォルトは CUSTOM
dashboardExtend json ビュー追加データ情報
dashboardMapping array[json] ビュー変数のフィールドマッピング設定リスト
iconSet json ダッシュボードアイコン情報
iconSet.url json ダッシュボード中アイコンリンクアドレス
iconSet.icon json ダッシュボード小アイコンリンクアドレス
icon string ダッシュボード小アイコンファイル名
thumbnail string ダッシュボード中アイコンファイル名
main json ダッシュボード内容構造
main.type string テンプレートタイプ。このフィールドはシステムフィールドのため、無視して構いません。
main.vars array[json] ビュー変数設定リスト
main.vars[#] json ビュー変数設定構造
main.groups array[string] チャートグループ名リスト
main.charts array[json] ビューのチャート設定リスト
main.charts[#] json チャート設定構造

dashboardMapping[#] の本体構造説明

パラメータ名 type 必須 説明

main.charts[#] の本体構造説明

パラメータ名 type 必須 説明
name string 必須 チャート名
type string 必須 チャートタイプ
pos json チャートの位置構造
pos.i string
pos.h string 高さ
pos.w string
pos.x string X 軸座標
pos.y string Y 軸座標
group json[string] グループ情報
group.name string グループ名。グループがない場合は null を許可
queries array[json] 必須 チャートクエリ文構造リスト

時系列チャート 構造 main.charts[#].type=sequence の本体構造パラメータは以下の通りです:

パラメータ名 type 必須 説明
name string 必須 チャート名
type string 必須 チャートタイプ
pos string 必須 チャートタイプ
queries array[json] 必須 チャートクエリ文構造リスト

main.vars[#] の本体構造説明

パラメータ名 type 必須 説明

リクエスト例

curl 'https://openapi.guance.com/api/v1/dashboards/create' \
-H 'DF-API-KEY: <DF-API-KEY>' \
-H 'Content-Type: application/json;charset=UTF-8' \
--data-raw '{"name": "x5T8APwi", "templateInfo": {"dashboardBindSet": [], "dashboardExtend": {}, "dashboardMapping": [], "dashboardOwnerType": "node", "dashboardType": "CUSTOM", "iconSet": {}, "main": {"charts": [{"extend": {"settings": {"chartType": "bar", "colors": [{"color": "#3ab8ff", "key": "count(trace_id){\"status\": \"ok\"}"}, {"color": "#f97575", "key": "count(trace_id){\"status\": \"error\"}"}], "openStack": true, "options": {"yAxis": {"axisLabel": {"color": "#666"}, "axisLine": {"show": true}, "axisTick": {"show": false}, "splitLine": {"show": false}, "splitNumber": 1}}, "xAxisShowType": "time"}}, "group": {"name": null}, "name": "Request Count", "pos": null, "queries": [{"checked": true, "datasource": "dataflux", "qtype": "dql", "query": {"density": "lower", "filter": [{"logic": "and", "name": "service", "op": "=", "value": "front-api"}], "groupBy": " by `status`", "groupByTime": "auto", "q": "T::re(`.*`):(count(`trace_id`)){ `service` = 'front-api' } [::auto] by `status`"}, "unit": "", "uuid": "6aed3c00-7a99-11ec-8689-536665ee3a48"}], "type": "sequence"}], "groups": [], "type": "template", "vars": []}, "summary": "", "tagInfo": [], "tags": [], "thumbnail": "", "title": "lwc-Tracing Resource"}}' \
--compressed 

レスポンス

{
    "code": 200,
    "content": {
        "chartGroupPos": [],
        "chartPos": [
            {
                "chartUUID": "chrt_xxxx32",
                "pos": {
                    "h": 9,
                    "i": 0,
                    "w": 8,
                    "x": 0,
                    "y": 0
                }
            },
            {
                "chartUUID": "chrt_xxxx32",
                "pos": {
                    "h": 9,
                    "i": 1,
                    "w": 8,
                    "x": 0,
                    "y": 9
                }
            },
            {
                "chartUUID": "chrt_xxxx32",
                "pos": {
                    "h": 9,
                    "i": 2,
                    "w": 8,
                    "x": 8,
                    "y": 0
                }
            },
            {
                "chartUUID": "chrt_xxxx32",
                "pos": {
                    "h": 9,
                    "i": 3,
                    "w": 8,
                    "x": 16,
                    "y": 0
                }
            },
            {
                "chartUUID": "chrt_xxxx32",
                "pos": {
                    "h": 9,
                    "i": 4,
                    "w": 8,
                    "x": 8,
                    "y": 9
                }
            },
            {
                "chartUUID": "chrt_xxxx32",
                "pos": {
                    "h": 9,
                    "i": 5,
                    "w": 8,
                    "x": 16,
                    "y": 9
                }
            }
        ],
        "createAt": 1641953280.0015242,
        "createdWay": "manual",
        "creator": "acnt_xxxx32",
        "dashboardBindSet": [],
        "deleteAt": -1,
        "extend": {},
        "iconSet": {
            "icon": "http://testing-static-res.cloudcare.cn/dataflux-template/dashboard/cpu/icon.svg",
            "url": "http://testing-static-res.cloudcare.cn/dataflux-template/dashboard/cpu/cpu.png"
        },
        "id": null,
        "mapping": [],
        "name": "CPU モニタリングビュー-lwctest",
        "ownerType": "node",
        "status": 0,
        "tag_info": [
            {
                "id": "tag_xxxx32",
                "name": "テスト"
            }
        ],
        "type": "CUSTOM",
        "updateAt": 1641953280.0015464,
        "updator": "acnt_xxxx32",
        "uuid": "dsbd_xxxx32",
        "workspaceUUID": "wksp_xxxx32"
    },
    "errorCode": "",
    "message": "",
    "success": true,
    "traceId": "TRACE-97C1194E-40E6-43A3-B6DF-6637D96BECDB"
} 

フィードバック

このページは役に立ちましたか?