# Referensi API Pemberitahuan Umum

Source: https://instatus.com/help/id/api/generic-notices

Pemberitahuan umum adalah spanduk permanen yang ditampilkan di halaman status Anda (terpisah dari insiden dan pemeliharaan). Pakai endpoint ini untuk mengelolanya secara terprogram.

## Mendapatkan semua pemberitahuan umum

**Endpoint:**

```bash
GET /v1/:page_id/generic-notices?page=:page&per_page=:per_page
```

- Nomor halaman bawaannya adalah 1.
- Nilai per_page bawaannya adalah 50 dan maksimumnya 100 item per halaman.

**Contoh respons:**

```json
[
  {
    "id": "cl9mq0ah50646mpvlmbrvf979",
    "name": "Scheduled DNS migration",
    "message": "We are migrating our DNS provider over the next week.",
    "messageHtml": "<p>We are migrating our DNS provider over the next week.</p>",
    "notify": false,
    "isCollapsed": false,
    "createdAt": "2022-10-24T11:53:46.505Z",
    "updatedAt": "2022-10-24T11:53:46.505Z",
    "siteId": "cl9fzgilx14063qjvl5oqdtxtg",
    "importedFrom": null
  }
]
```

## Mendapatkan sebuah pemberitahuan umum

**Endpoint:**

```bash
GET /v1/:page_id/generic-notices/:generic_notice_id
```

**Contoh respons:**

```json
{
  "id": "cl9mq0ah50646mpvlmbrvf979",
  "name": "Scheduled DNS migration",
  "message": "We are migrating our DNS provider over the next week.",
  "messageHtml": "<p>We are migrating our DNS provider over the next week.</p>",
  "notify": false,
  "isCollapsed": false,
  "createdAt": "2022-10-24T11:53:46.505Z",
  "updatedAt": "2022-10-24T11:53:46.505Z",
  "siteId": "cl9fzgilx14063qjvl5oqdtxtg",
  "importedFrom": null
}
```

## Menambahkan pemberitahuan umum

**Endpoint:**

```bash
POST /v1/:page_id/generic-notices
```

**Parameter body:**

- `name` (wajib) — judul pemberitahuan.
- `message` — isi pemberitahuan. HTML didukung.
- `notify` — apakah pelanggan langganan diberi tahu. Nilai bawaannya `false`.
- `isCollapsed` — apakah pemberitahuan diciutkan secara bawaan. Nilai bawaannya `false`.
- `translations` — terjemahan opsional untuk `name` dan `message`, dikunci berdasarkan kode bahasa.

**Contoh permintaan:**

```json
{
  "name": "Scheduled DNS migration",
  "message": "We are migrating our DNS provider over the next week.",
  "notify": false,
  "isCollapsed": false,
  "translations": {
    "name": {
      "fr": "Migration DNS planifiée"
    },
    "message": {
      "fr": "Nous migrons notre fournisseur DNS au cours de la semaine prochaine."
    }
  }
}
```

**Contoh respons:**

```json
{
  "id": "cl9xobpoe00614tvldhh90t0w",
  "name": "Scheduled DNS migration",
  "message": "We are migrating our DNS provider over the next week.",
  "messageHtml": "<p>We are migrating our DNS provider over the next week.</p>",
  "notify": false,
  "isCollapsed": false,
  "createdAt": "2022-11-01T03:52:08.126Z",
  "updatedAt": "2022-11-01T03:52:08.126Z",
  "siteId": "cl9fzgilx14063qjvl5oqdtxtg",
  "importedFrom": null,
  "translations": {
    "name": {
      "fr": "Migration DNS planifiée"
    },
    "message": {
      "fr": "Nous migrons notre fournisseur DNS au cours de la semaine prochaine."
    }
  }
}
```

## Memperbarui pemberitahuan umum

**Endpoint:**

```bash
PUT /v1/:page_id/generic-notices/:generic_notice_id
```

Hanya kolom yang Anda kirim yang diperbarui.

**Contoh permintaan:**

```json
{
  "name": "Scheduled DNS migration (rescheduled)",
  "message": "The migration has been rescheduled to next month.",
  "isCollapsed": true
}
```

**Contoh respons:**

```json
{
  "id": "cl9xobpoe00614tvldhh90t0w",
  "name": "Scheduled DNS migration (rescheduled)",
  "message": "The migration has been rescheduled to next month.",
  "messageHtml": "<p>The migration has been rescheduled to next month.</p>",
  "notify": false,
  "isCollapsed": true,
  "createdAt": "2022-11-01T03:52:08.126Z",
  "updatedAt": "2022-11-02T09:14:22.501Z",
  "siteId": "cl9fzgilx14063qjvl5oqdtxtg",
  "importedFrom": null
}
```

## Menghapus pemberitahuan umum

**Endpoint:**

```bash
DELETE /v1/:page_id/generic-notices/:generic_notice_id
```

**Contoh respons:**

```json
{
  "id": "cl9xobpoe00614tvldhh90t0w",
  "name": "Scheduled DNS migration (rescheduled)",
  "message": "The migration has been rescheduled to next month.",
  "messageHtml": "<p>The migration has been rescheduled to next month.</p>",
  "notify": false,
  "isCollapsed": true,
  "createdAt": "2022-11-01T03:52:08.126Z",
  "updatedAt": "2022-11-02T09:14:22.501Z",
  "siteId": "cl9fzgilx14063qjvl5oqdtxtg",
  "importedFrom": null
}
```
