사용자 및 조직 환경설정 API
사용자 및 조직 환경설정 API
이 문서는 사용자와 조직의 환경설정(preferences)을 조회하고 갱신하는 API를 설명해요. 테마, 홈 대시보드, 시간대 등을 관리할 수 있습니다.
출처: 문서
본문
참고: Grafana 13부터
/api엔드포인트는/apis경로를 위해 더 이상 사용되지 않습니다(deprecated). Grafana가 기존 API를 마이그레이션하는 동안 현재 여러분이 사용하는 레거시 API와 정확히 일치하는 항목이 없을 수도 있어요. 이 변경은 현재 설정을 방해하거나 깨지 않습니다. 레거시 API는 비활성화되지 않으며 완전히 접근 가능하고 정상 작동하지만,/api경로는 더 이상 업데이트되지 않습니다. 자세한 내용은 Grafana의 새 API 구조를 참고하세요.
키 (Keys)
theme– 다음 중 하나:light,dark, 또는 기본 테마를 의미하는 빈 문자열homeDashboardId– 더 이상 사용되지 않음(deprecated). 대신homeDashboardUID를 사용하세요.homeDashboardUID– 대시보드의:uidtimezone– 유효한 IANA 시간대 문자열(예:America/New_York,Europe/London),utc,browser, 또는 기본값을 의미하는 빈 문자열
키를 생략하면 현재 값이 시스템 기본값으로 대체됩니다.
현재 사용자 환경설정 가져오기
GET /api/user/preferences
예시 요청:
GET /api/user/preferences HTTP/1.1
Accept: application/json
Content-Type: application/json
Authorization: Bearer <SERVI...KEN>
예시 응답:
HTTP/1.1 200
Content-Type: application/json
{
"theme": "",
"homeDashboardId": 217,
"homeDashboardUID": "jcIIG-07z",
"timezone": "utc",
"weekStart": "",
"navbar": {
"bookmarkUrls": null
},
"queryHistory": {
"homeTab": ""
}
}
현재 사용자 환경설정 갱신하기
PUT /api/user/preferences
예시 요청:
PUT /api/user/preferences HTTP/1.1
Accept: application/json
Content-Type: application/json
Authorization: Bearer <SERVI...KEN>
{
"theme": "",
"homeDashboardUID":"home",
"timezone":"utc"
}
예시 응답:
HTTP/1.1 200
Content-Type: text/plain; charset=utf-8
{"message":"Preferences updated"}
현재 사용자 환경설정 부분 갱신하기
다른 환경설정을 수정하지 않고 하나 이상의 환경설정을 갱신합니다.
PATCH /api/user/preferences
예시 요청:
PATCH /api/user/preferences HTTP/1.1
Accept: application/json
Content-Type: application/json
Authorization: Bearer <SERVI...KEN>
{
"theme": "dark"
}
예시 응답:
HTTP/1.1 200
Content-Type: text/plain; charset=utf-8
{"message":"Preferences updated"}
현재 조직 환경설정 가져오기
GET /api/org/preferences
예시 요청:
GET /api/org/preferences HTTP/1.1
Accept: application/json
Content-Type: application/json
Authorization: Bearer <SERVI...KEN>
예시 응답:
HTTP/1.1 200
Content-Type: application/json
{
"theme": "",
"homeDashboardId": 0,
"homeDashboardUID": "",
"timezone": "",
"weekStart": "",
"navbar": {
"bookmarkUrls": null
},
"queryHistory": {
"homeTab": ""
}
}
현재 조직 환경설정 갱신하기
PUT /api/org/preferences
예시 요청:
PUT /api/org/preferences HTTP/1.1
Accept: application/json
Content-Type: application/json
Authorization: Bearer <SERVI...KEN>
{
"theme": "",
"homeDashboardUID":"home",
"timezone":"utc"
}
예시 응답:
HTTP/1.1 200
Content-Type: text/plain; charset=utf-8
{"message":"Preferences updated"}
현재 조직 환경설정 부분 갱신하기
다른 환경설정을 수정하지 않고 하나 이상의 환경설정을 갱신합니다.
PATCH /api/org/preferences
예시 요청:
PATCH /api/org/preferences HTTP/1.1
Accept: application/json
Content-Type: application/json
Authorization: Bearer <SERVI...KEN>
{
"theme": "dark"
}
예시 응답:
HTTP/1.1 200
Content-Type: text/plain; charset=utf-8
{"message":"Preferences updated"}