

기계 번역으로 제공되는 번역입니다. 제공된 번역과 원본 영어의 내용이 상충하는 경우에는 영어 버전이 우선합니다.

# 알림 채널 API 알림
<a name="v12-Grafana-API-AlertingNotificationChannels"></a>

알림 채널 API를 사용하여 알림 채널을 생성, 업데이트, 삭제 및 검색합니다.

알림 채널의 식별자(ID)는 자동으로 증가하는 숫자 값이며 워크스페이스당 고유합니다. 알림 채널의 고유 식별자(uid)를 사용하여 여러 워크스페이스 사이에서 폴더를 고유하게 식별할 수 있습니다. 알림 채널을 생성할 때 제공하지 않으면 자동으로 생성됩니다. UID를 사용하면 알림 채널에 액세스하고 여러 Amazon Managed Grafana 워크스페이스 사이에서 알림 채널을 동기화할 때 일관된 URL을 사용할 수 있습니다.

**참고**  
Amazon Managed Grafana 워크스페이스에서 Grafana API를 사용하려면 유효한 서비스 계정 토큰이 있어야 합니다. API 요청의 `Authorization` 필드에 이를 포함합니다.

## 모든 알림 채널 가져오기
<a name="v12-Grafana-API-AlertNotificationChannels-getall"></a>

인증된 사용자가 볼 수 있는 권한이 있는 모든 알림 채널을 반환합니다.

```
GET /api/alert-notifications
```

**요청 예제**

```
GET /api/alert-notifications HTTP/1.1
Accept: application/json
Content-Type: application/json
Authorization: Bearer 1234abcd567exampleToken890
```

**응답의 예**

```
HTTP/1.1 200
Content-Type: application/json

[
  {
    "id": 1,
    "uid": "sns-uid",
    "name": "test",
    "type": "sns",
    "isDefault": false,
    "sendReminder": false,
    "disableResolveMessage": false,
    "frequency": "",
    "created": "2023-09-08T19:57:56Z",
    "updated": "2023-09-08T19:57:56Z",
    "settings": {
      "authProvider": "default",
      "autoResolve": true,
      "httpMethod": "POST",
      "messageFormat": "json",
      "severity": "critical",
      "topic": "<SNS-TOPIC-ARN>",
      "uploadImage": false
    },
    "secureFields": {}
  }
]
```

## 모든 알림 채널 가져오기(조회)
<a name="v12-Grafana-API-AlertNotificationChannels-getlookup"></a>

모든 알림 채널을 반환합니다(단, 세부 정보는 적음). 인증된 사용자가 액세스할 수 있으며 주로 알림 규칙을 구성할 때 Grafana 워크스페이스 콘솔 UI에서 알림 전달 채널을 제공하는 데 사용됩니다.

```
GET /api/alert-notifications/lookup
```

**요청 예제**

```
GET /api/alert-notifications/lookup HTTP/1.1
Accept: application/json
Content-Type: application/json
Authorization: Bearer 1234abcd567exampleToken890
```

**응답의 예**

```
HTTP/1.1 200
Content-Type: application/json

[
  {
    "id": 1,
    "uid": "sns-uid",
    "name": "test",
    "type": "sns",
    "isDefault": false
  },
  {
    "id": 2,
    "uid": "slack-uid",
    "name": "Slack",
    "type": "slack",
    "isDefault": false
  }
]
```

## UID로 모든 알림 채널 가져오기
<a name="v12-Grafana-API-AlertNotificationChannels-getbyUID"></a>

```
GET /api/alert-notifications/uid/:uid
```

**요청 예제**

```
GET /api/alert-notifications/uid/sns-uid HTTP/1.1
Accept: application/json
Content-Type: application/json
Authorization: Bearer 1234abcd567exampleToken890
```

**응답의 예**

```
HTTP/1.1 200
Content-Type: application/json

{
  "id": 1,
  "uid": "sns-uid",
  "name": "test",
  "type": "sns",
  "isDefault": false,
  "sendReminder": false,
  "disableResolveMessage": false,
  "frequency": "",
  "created": "2023-09-08T19:57:56Z",
  "updated": "2023-09-08T19:57:56Z",
  "settings": {
    "authProvider": "default",
    "autoResolve": true,
    "httpMethod": "POST",
    "messageFormat": "json",
    "severity": "critical",
    "topic": "<SNS-TOPIC-ARN>",
    "uploadImage": false
  },
  "secureFields": {}
}
```

## ID로 모든 알림 채널 가져오기
<a name="v12-Grafana-API-AlertNotificationChannels-getbyId"></a>

```
GET /api/alert-notifications/:id
```

**요청 예제**

```
GET /api/alert-notifications/1 HTTP/1.1
Accept: application/json
Content-Type: application/json
Authorization: Bearer 1234abcd567exampleToken890
```

**응답의 예**

```
HTTP/1.1 200
Content-Type: application/json

{
  "id": 1,
  "uid": "sns-uid",
  "name": "test",
  "type": "sns",
  "isDefault": false,
  "sendReminder": false,
  "disableResolveMessage": false,
  "frequency": "",
  "created": "2023-09-08T19:57:56Z",
  "updated": "2023-09-08T19:57:56Z",
  "settings": {
    "authProvider": "default",
    "autoResolve": true,
    "httpMethod": "POST",
    "messageFormat": "json",
    "severity": "critical",
    "topic": "<SNS-TOPIC-ARN>",
    "uploadImage": false
  },
  "secureFields": {}
}
```

## 알림 채널 생성
<a name="v12-Grafana-API-AlertNotificationChannels-Create"></a>

Amazon Managed Grafana에서 지원하는 알림 채널을 확인하려면 [연락 지점 작업](alert-contact-points.md)에서 지원되는 알림 목록을 참조하세요.

Grafana 버전 12에서는 알림 프로비저닝 API를 사용하여 연락 지점을 생성합니다. 레거시 `/api/alert-notifications` 엔드포인트를 더 이상 사용할 수 없습니다.

**요청 예제**

```
POST /api/v1/provisioning/contact-points HTTP/1.1
Accept: application/json
Content-Type: application/json
Authorization: Bearer 1234abcd567exampleToken890

{
  "uid": "new-sns-uid",
  "name": "sns alert notification",
  "type": "sns",
  "isDefault": false,
  "sendReminder": false,
  "settings": {
    "topic_arn": "<SNS-TOPIC-ARN>",
    "subject": "<SUBJECT>"
  }
}
```

## UID로 알림 채널 업데이트
<a name="v12-Grafana-API-AlertNotificationChannels-UpdatebyUID"></a>

```
PUT /api/alert-notifications/uid/:uid
```

**요청 예제**

```
PUT /api/alert-notifications/uid/sns-uid HTTP/1.1
Accept: application/json
Content-Type: application/json
Authorization: Bearer 1234abcd567exampleToken890

{
  "uid": "sns-uid", // optional
  "name": "sns alert notification",  //Required
  "type":  "sns", //Required
  "isDefault": false,
  "sendReminder": true,
  "frequency": "15m",
  "settings": {
    "authProvider": "default",
    "autoResolve": true,
    "httpMethod": "POST",
    "messageFormat": "json",
    "severity": "critical",
    "topic": "<SNS-TOPIC-ARN>",
    "uploadImage": false
  }
}
```

**응답의 예**

```
HTTP/1.1 200
Content-Type: application/json

{
  "id": 1,
  "uid": "sns-uid",
  "name": "sns alert notification",
  "type": "sns",
  "isDefault": false,
  "sendReminder": true,
  "frequency": "15m",
  "settings": {
    "authProvider": "default",
    "autoResolve": true,
    "httpMethod": "POST",
    "messageFormat": "json",
    "severity": "critical",
    "topic": "<SNS-TOPIC-ARN>",
    "uploadImage": false
  },
  "created": "2017-01-01 12:34",
  "updated": "2017-01-01 12:34"
}
```

## ID로 알림 채널 업데이트
<a name="v12-Grafana-API-AlertNotificationChannels-UpdatebyId"></a>

```
PUT /api/alert-notifications/:id
```

**요청 예제**

```
PUT /api/alert-notifications/1 HTTP/1.1
Accept: application/json
Content-Type: application/json
Authorization: Bearer 1234abcd567exampleToken890

{
  "id": 1,
  "uid": "sns-uid", // optional
  "name": "sns alert notification",  //Required
  "type":  "sns", //Required
  "isDefault": false,
  "sendReminder": true,
  "frequency": "15m",
  "settings": {
    "authProvider": "default",
    "autoResolve": true,
    "httpMethod": "POST",
    "messageFormat": "json",
    "severity": "critical",
    "topic": "<SNS-TOPIC-ARN>",
    "uploadImage": false
  }
}
```

**응답의 예**

```
HTTP/1.1 200
Content-Type: application/json

{
  "id": 1,
  "uid": "sns-uid",
  "name": "sns alert notification",
  "type": "sns",
  "isDefault": false,
  "sendReminder": true,
  "frequency": "15m",
  "settings": {
    "authProvider": "default",
    "autoResolve": true,
    "httpMethod": "POST",
    "messageFormat": "json",
    "severity": "critical",
    "topic": "<SNS-TOPIC-ARN>",
    "uploadImage": false
  },
  "created": "2017-01-01 12:34",
  "updated": "2017-01-01 12:34"
}
```

## UID로 알림 채널 삭제
<a name="v12-Grafana-API-AlertNotificationChannels-DeletebyUID"></a>

```
DELETE /api/alert-notifications/uid/:uid
```

**요청 예제**

```
DELETE /api/alert-notifications/uid/sns-uid HTTP/1.1
Accept: application/json
Content-Type: application/json
Authorization: Bearer 1234abcd567exampleToken890
```

**응답의 예**

```
HTTP/1.1 200
Content-Type: application/json

{
  "message": "Notification deleted"
}
```

## ID로 알림 채널 삭제
<a name="v12-Grafana-API-AlertNotificationChannels-DeletebyId"></a>

```
DELETE /api/alert-notifications/:id
```

**요청 예제**

```
DELETE /api/alert-notifications/1 HTTP/1.1
Accept: application/json
Content-Type: application/json
Authorization: Bearer 1234abcd567exampleToken890
```

**응답의 예**

```
HTTP/1.1 200
Content-Type: application/json

{
  "message": "Notification deleted"
}
```

## 알림 채널 테스트
<a name="v12-Grafana-API-AlertNotificationChannels-Test"></a>

지정된 알림 채널 유형 및 설정에 대한 테스트 알림 메시지를 보냅니다.

```
POST /api/alert-notifications/test
```

**요청 예제**

```
POST /api/alert-notifications/test HTTP/1.1
Accept: application/json
Content-Type: application/json
Authorization: Bearer 1234abcd567exampleToken890

{
  "type":  "sns",
  "settings": {
    "authProvider": "default",
    "autoResolve": true,
    "httpMethod": "POST",
    "messageFormat": "json",
    "severity": "critical",
    "topic": "<SNS-TOPIC-ARN>",
    "uploadImage": false
  }
}
```

**응답의 예**

```
HTTP/1.1 200
Content-Type: application/json

{
  "message": "Test notification sent"
}
```