브로드캐스트 메시지 API

Tier: Free, Premium, Ultimate Offering: Self-managed, GitLab Dedicated

브로드캐스트 메시지 API는 브로드캐스트 메시지에서 작동합니다.

GitLab 12.8부터 GET 요청에는 인증이 필요하지 않습니다. 다른 모든 브로드캐스트 메시지 API 엔드포인트는 관리자만 액세스할 수 있습니다. 다음은 관련되지 않은 요청입니다:

  • 게스트는 401 Unauthorized가 발생합니다.
  • 일반 사용자는 403 Forbidden이 발생합니다.

모든 브로드캐스트 메시지 가져오기

Tier: Free, Premium, Ultimate Offering: GitLab.com, Self-managed, GitLab Dedicated

모든 브로드캐스트 메시지를 나열합니다.

GET /broadcast_messages

예시 요청:

curl "https://gitlab.example.com/api/v4/broadcast_messages"

예시 응답:

[
    {
        "message":"브로드캐스트 메시지 예시",
        "starts_at":"2016-08-24T23:21:16.078Z",
        "ends_at":"2016-08-26T23:21:16.080Z",
        "font":"#FFFFFF",
        "id":1,
        "active": false,
        "target_access_levels": [10,30],
        "target_path": "*/welcome",
        "broadcast_type": "banner",
        "dismissable": false
    }
]

특정 브로드캐스트 메시지 가져오기

Tier: Free, Premium, Ultimate Offering: GitLab.com, Self-managed, GitLab Dedicated

특정 브로드캐스트 메시지를 가져옵니다.

GET /broadcast_messages/:id

매개변수:

속성 유형 필수 설명
id integer yes 검색할 브로드캐스트 메시지의 ID.

예시 요청:

curl "https://gitlab.example.com/api/v4/broadcast_messages/1"

예시 응답:

{
    "message":"배포 진행 중",
    "starts_at":"2016-08-24T23:21:16.078Z",
    "ends_at":"2016-08-26T23:21:16.080Z",
    "font":"#FFFFFF",
    "id":1,
    "active":false,
    "target_access_levels": [10,30],
    "target_path": "*/welcome",
    "broadcast_type": "banner",
    "dismissable": false
}

브로드캐스트 메시지 만들기

새로운 브로드캐스트 메시지를 만듭니다.

POST /broadcast_messages

매개변수:

속성 유형 필수 설명
message string yes 표시할 메시지.
starts_at datetime no 시작 시간 (기본값은 현재 시간(UTC)입니다). ISO 8601 형식으로 예상됨 (2019-03-15T08:00:00Z)
ends_at datetime no 종료 시간 (기본값은 현재 시간(UTC)에서 1시간 후). ISO 8601 형식으로 예상됨 (2019-03-15T08:00:00Z)
font string no 전경색 hex 코드.
target_access_levels array of integers no 브로드캐스트 메시지의 대상 액세스 수준(역할).
target_path string no 브로드캐스트 메시지의 대상 경로.
broadcast_type string no 모양 타입 (기본값은 배너).
dismissable boolean no 사용자가 메시지를 닫을 수 있는지 여부.

target_access_levelsGitlab::Access 모듈에서 정의됩니다. 다음 수준이 유효합니다:

  • 게스트 (10)
  • 보고자 (20)
  • 개발자 (30)
  • 유지자 (40)
  • 소유자 (50)

예시 요청:

curl --data "message=배포 진행 중&target_access_levels[]=10&target_access_levels[]=30" \
     --header "PRIVATE-TOKEN: <your_access_token>" \
     "https://gitlab.example.com/api/v4/broadcast_messages"

예시 응답:

{
    "message":"배포 진행 중",
    "starts_at":"2016-08-26T00:41:35.060Z",
    "ends_at":"2016-08-26T01:41:35.060Z",
    "font":"#FFFFFF",
    "id":1,
    "active": true,
    "target_access_levels": [10,30],
    "target_path": "*/welcome",
    "broadcast_type": "notification",
    "dismissable": false
}

브로드캐스트 메시지 업데이트

기존의 브로드캐스트 메시지를 업데이트합니다.

PUT /broadcast_messages/:id

매개변수:

속성 유형 필수 설명
id 정수 업데이트할 브로드캐스트 메시지의 ID.
message 문자열 아니오 표시할 메시지.
starts_at 날짜 및 시간 아니오 시작 시간 (UTC). ISO 8601 형식으로 입력 (2019-03-15T08:00:00Z).
ends_at 날짜 및 시간 아니오 종료 시간 (UTC). ISO 8601 형식으로 입력 (2019-03-15T08:00:00Z).
font 문자열 아니오 전경색 HEX 코드.
target_access_levels 정수 배열 아니오 브로드캐스트 메시지의 대상 액세스 수준(역할).
target_path 문자열 아니오 브로드캐스트 메시지의 대상 경로.
broadcast_type 문자열 아니오 표시 유형(기본값은 배너).
dismissable 부울 아니오 사용자가 메시지를 무시할 수 있는지 여부?

target_access_levelsGitlab::Access 모듈에서 정의됩니다. 다음 수준이 유효합니다:

  • Guest (10)
  • Reporter (20)
  • Developer (30)
  • Maintainer (40)
  • Owner (50)

예시 요청:

curl --request PUT --data "message=메시지 업데이트" \
     --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/broadcast_messages/1"

예시 응답:

{
    "message":"메시지 업데이트",
    "starts_at":"2016-08-26T00:41:35.060Z",
    "ends_at":"2016-08-26T01:41:35.060Z",
    "font":"#FFFFFF",
    "id":1,
    "active": true,
    "target_access_levels": [10,30],
    "target_path": "*/welcome",
    "broadcast_type": "notification",
    "dismissable": false
}

브로드캐스트 메시지 삭제

브로드캐스트 메시지를 삭제합니다.

DELETE /broadcast_messages/:id

매개변수:

속성 유형 필수 설명
id 정수 삭제할 브로드캐스트 메시지의 ID.

예시 요청:

curl --request DELETE --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/broadcast_messages/1"