# Dokumentacja API ogłoszeń ogólnych

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

Ogłoszenia ogólne to trwałe banery wyświetlane na stronie statusu (niezależne od incydentów i przerw technicznych). Te endpointy pozwalają zarządzać nimi programowo.

## Pobierz wszystkie ogłoszenia ogólne

**Endpoint:**

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

- Domyślny numer strony to 1.
- Domyślna wartość per_page to 50, a maksymalna to 100 elementów na stronę.

**Przykładowa odpowiedź:**

```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
  }
]
```

## Pobierz ogłoszenie ogólne

**Endpoint:**

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

**Przykładowa odpowiedź:**

```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
}
```

## Dodaj ogłoszenie ogólne

**Endpoint:**

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

**Parametry treści:**

- `name` (wymagane) — tytuł ogłoszenia.
- `message` — treść ogłoszenia. HTML jest obsługiwany.
- `notify` — czy powiadomić subskrybentów. Domyślnie `false`.
- `isCollapsed` — czy ogłoszenie jest domyślnie zwinięte. Domyślnie `false`.
- `translations` — opcjonalne tłumaczenia pól `name` i `message`, kluczowane kodem języka.

**Przykładowe żądanie:**

```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."
    }
  }
}
```

**Przykładowa odpowiedź:**

```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."
    }
  }
}
```

## Zaktualizuj ogłoszenie ogólne

**Endpoint:**

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

Aktualizowane są tylko przesłane przez Ciebie pola.

**Przykładowe żądanie:**

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

**Przykładowa odpowiedź:**

```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
}
```

## Usuń ogłoszenie ogólne

**Endpoint:**

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

**Przykładowa odpowiedź:**

```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
}
```
