방송 메시지 API

Tier: Free, Premium, Ultimate Offering: Self-Managed, GitLab Dedicated
  • target_access_levels은 기본적으로 비활성화되어 있지만 GitLab 14.8에서 role_targeted_broadcast_messages라는 플래그와 함께 도입되었습니다.
  • color 매개변수는 GitLab 15.6에서 제거되었습니다.

방송 메시지 API는 방송 메시지에서 작동합니다.

GET 요청에는 인증이 필요하지 않습니다. 그 외의 방송 메시지 API 엔드포인트는 관리자만 액세스할 수 있습니다. 다음은 비-GET 요청에 대한 권한 부여 방식입니다.

  • 게스트는 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":"Example broadcast 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":"Deploy in progress",
    "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 전경색 16진수 코드.
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=Deploy in progress&target_access_levels[]=10&target_access_levels[]=30" \
     --header "PRIVATE-TOKEN: <your_access_token>" \
     "https://gitlab.example.com/api/v4/broadcast_messages"

예시 응답:

{
    "message":"Deploy in progress",
    "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 integer yes 업데이트할 방송 메시지의 ID.
message string no 표시할 메시지.
starts_at datetime no 시작 시간(UTC). ISO 8601 형식 예상 (2019-03-15T08:00:00Z)
ends_at datetime no 종료 시간(UTC). ISO 8601 형식 예상 (2019-03-15T08:00:00Z)
font string no 전경색 16진수 코드.
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 --request PUT --data "message=Update message" \
     --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/broadcast_messages/1"

예시 응답:

{
    "message":"Update 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 integer yes 삭제할 방송 메시지의 ID.

예시 요청:

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