콘텐츠로 이동

생성



POST /api/v1/dashboards/create

개요

빈 대시보드를 생성하거나, 대시보드 템플릿을 기반으로 대시보드를 생성합니다.

규칙

매개변수의 name 필드는 templateInfotitle을 덮어씁니다.

Body 요청 매개변수

매개변수명 유형 필수 설명
name string Y 대시보드 이름
Null 허용: False
최대 길이: 128
desc string 설명
예시: 설명1
Null 허용: False
빈 문자열 허용: True
최대 길이: 2048
recoverIdentifier boolean 중복된 식별자 ID/이름 관련 객체를 덮어쓸지 여부. false-중복 그룹만 반환, true-중복 그룹의 관련 객체를 삭제한 후 계속 생성
Null 허용: False
identifier string 식별자 ID --2024.12.25 신규 식별자 ID 추가
예시: xxxx
Null 허용: False
빈 문자열 허용: True
최대 길이: 128
extend json 대시보드의 추가 데이터, 기본값 {}
예시: {}
Null 허용: False
mapping array 뷰 변수의 필드 매핑 정보, 기본값 []
예시: [{'class': 'host_processes', 'field': 'create_time', 'mapping': 'username', 'datasource': 'object'}]
Null 허용: False
tagNames array 연결된 태그 목록
Null 허용: False
templateInfo json 대시보드 템플릿 데이터
예시: {}
Null 허용: False
빈 문자열 허용: False
specifyDashboardUUID string 새로 생성할 대시보드의 uuid 지정, dsbd_custom_ 접두사 뒤에 32자리 소문자 영숫자
예시: dsbd_custom_xxxx32
Null 허용: False
빈 문자열 허용: False
$matchRegExp: ^dsbd_custom_[a-z0-9]{32}$
isPublic int 공개 여부, 1은 공개, 0은 비공개, -1은 사용자 정의
예시: 1
Null 허용: False
openPermissionSet boolean 2024-11-27 반복, 해당 필드는 더 이상 사용되지 않음. 이후 isPublic을 -1로 설정하여 사용자 정의 권한 구성을 활성화
Null 허용: False
permissionSet array 사용자 정의 시 isPublic이 -1인 경우의 작업 권한 구성, 구성 가능(소유자 제외 역할, 멤버 uuid, 팀 uuid)
예시: ['wsAdmin', 'acnt_xxxx', 'group_yyyy']
Null 허용: False
readPermissionSet array 사용자 정의 시 isPublic이 -1인 경우의 읽기 권한 구성, 구성 가능(소유자 제외 역할, 멤버 uuid, 팀 uuid)
예시: ['wsAdmin', 'acnt_xxxx', 'group_yyyy']
Null 허용: False

매개변수 추가 설명

1. 인터페이스 동작

인터페이스는 먼저 현재 생성할 대시보드의 이름과 식별자 ID의 충돌 여부를 확인하며, 충돌 결과는 다음 세 가지 유형으로 반환됩니다.

  • name_and_identifier: 이름과 식별자 ID가 동시에 중복됨
  • identifier: 식별자 ID만 중복됨
  • name: 이름만 중복됨

recoverIdentifier=false 또는 미전달 시: - 대시보드를 생성하지 않음 - repeatInfo를 직접 반환

recoverIdentifier=true 시: - 위 세 가지 중복 그룹에서 일치하는 관련 대시보드를 삭제 - 이후 새 대시보드 생성 계속


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의 주요 구조 설명

매개변수명 유형 필수 설명
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[#]의 주요 구조 설명

매개변수명 유형 필수 설명

main.charts[#]의 주요 구조 설명

매개변수명 유형 필수 설명
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의 주요 구조 매개변수는 다음과 같습니다:

매개변수명 유형 필수 설명
name string 필수 차트 이름
type string 필수 차트 유형
pos string 필수 차트 유형
queries array[json] 필수 차트 쿼리 문 구조 목록

main.vars[#]의 주요 구조 설명

매개변수명 유형 필수 설명

요청 예시

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"
}

문서 평가

이 페이지가 도움이 되었나요?