Team Sync API

Team Sync API

이 문서는 Grafana Enterprise에서 팀과 외부 그룹을 동기화하는 Team Sync API를 설명해요. 외부 그룹을 가져오고, 추가하고, 제거하고, 검색할 수 있습니다. Team Sync는 Grafana Enterprise에서만 사용할 수 있어요. Grafana Enterprise에 대해 더 알아보세요.

출처: 문서

본문

참고: Grafana 13부터 /api 엔드포인트는 /apis 경로를 위해 더 이상 사용되지 않습니다(deprecated). Grafana가 기존 API를 마이그레이션하는 동안 현재 여러분이 사용하는 레거시 API와 정확히 일치하는 항목이 없을 수도 있어요. 이 변경은 현재 설정을 방해하거나 깨지 않습니다. 레거시 API는 비활성화되지 않으며 완전히 접근 가능하고 정상 작동하지만, /api 경로는 더 이상 업데이트되지 않습니다. 자세한 내용은 Grafana의 새 API 구조를 참고하세요.

Grafana Enterprise를 실행 중이라면 일부 엔드포인트에 특정 권한이 필요합니다. 자세한 내용은 역할 기반 접근 제어 권한을 참고하세요.

외부 그룹 가져오기

GET /api/teams/:teamId/groups

필요 권한 (소개 부분의 참고 참고):

액션 범위
teams.permissions:read teams:*

예시 요청:

GET /api/teams/1/groups HTTP/1.1
Accept: application/json
Content-Type: application/json
Authorization: Bearer <SERVI...KEN>

예시 응답:

HTTP/1.1 200
Content-Type: application/json

[
  {
    "orgId": 1,
    "teamId": 1,
    "groupId": "cn=editors,ou=groups,dc=grafana,dc=org"
  }
]

상태 코드:

  • 200 – OK
  • 401 – 인증되지 않음
  • 403 – 권한 거부 (Permission denied)

외부 그룹 추가하기

POST /api/teams/:teamId/groups

필요 권한:

액션 범위
teams.permissions:write teams:*

예시 요청:

POST /api/teams/1/groups HTTP/1.1
Accept: application/json
Content-Type: application/json
Authorization: Bearer ***

{
  "groupId": "cn=editors,ou=groups,dc=grafana,dc=org"
}

예시 응답:

HTTP/1.1 200
Content-Type: application/json

{"message":"Group added to Team"}

상태 코드:

  • 200 – OK
  • 400 – 그룹이 이미 이 팀에 추가됨
  • 401 – 인증되지 않음
  • 403 – 권한 거부
  • 404 – 팀을 찾을 수 없음

외부 그룹 제거하기

DELETE /api/teams/:teamId/groups?groupId=external-group-id

필요 권한:

액션 범위
teams.permissions:write teams:*

예시 요청:

DELETE /api/teams/1/groups?groupId=cn%3Deditors%2Cou%3Dgroups%2Cdc%3Dgrafana%2Cdc%3Dorg HTTP/1.1
Accept: application/json
Content-Type: application/json
Authorization: Bearer <SERVI...KEN>

예시 응답:

HTTP/1.1 200
Content-Type: application/json

{"message":"Team Group removed"}

상태 코드:

  • 200 – OK
  • 401 – 인증되지 않음
  • 403 – 권한 거부
  • 404 – 팀을 찾을 수 없음/그룹을 찾을 수 없음

팀 그룹 검색하기

GET /api/teams/:teamId/groups/search

페이징을 지원하는 팀 그룹 검색입니다.

필요 권한:

액션 범위
teams.permissions:read teams:*

예시 요청:

GET /api/teams/1/groups/search?name=editors&query=group&page=1&perpage=10 HTTP/1.1
Accept: application/json
Content-Type: application/json
Authorization: Bearer <SERVI...KEN>

예시 응답:

HTTP/1.1 200
Content-Type: application/json

[
  {
    "totalCount": 1,
    "teamGroups": [
      {
        "orgId": 1,
        "teamId": 1,
        "groupId": "cn=editors,ou=groups,dc=grafana,dc=org"
      }
    ],
    "page": 1,
    "perPage": 10
  }
]

상태 코드:

  • 200 – OK
  • 400 – 잘못된 요청 (잘못된 팀 ID 형식 또는 누락된 쿼리 파라미터)
  • 401 – 인증되지 않음
  • 403 – 권한 거부
  • 500 – 내부 서버 오류

더 알아보기 (Learn more)