# Riferimento API degli avvisi generali

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

Gli avvisi generali sono banner permanenti mostrati sulla tua status page (separati da incidenti e manutenzioni). Usa questi endpoint per gestirli in modo programmatico.

## Ottenere tutti gli avvisi generali

**Endpoint:**

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

- Il numero di pagina predefinito è 1.
- Il valore predefinito di per_page è 50 e il massimo è 100 elementi per pagina.

**Esempio di risposta:**

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

## Ottenere un avviso generale

**Endpoint:**

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

**Esempio di risposta:**

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

## Aggiungere un avviso generale

**Endpoint:**

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

**Parametri del body:**

- `name` (obbligatorio) — il titolo dell'avviso.
- `message` — il corpo dell'avviso. L'HTML è supportato.
- `notify` — se avvisare gli iscritti. Il valore predefinito è `false`.
- `isCollapsed` — se l'avviso è compresso per impostazione predefinita. Il valore predefinito è `false`.
- `translations` — traduzioni facoltative di `name` e `message`, indicizzate per codice lingua.

**Esempio di richiesta:**

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

**Esempio di risposta:**

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

## Aggiornare un avviso generale

**Endpoint:**

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

Vengono aggiornati solo i campi che invii.

**Esempio di richiesta:**

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

**Esempio di risposta:**

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

## Eliminare un avviso generale

**Endpoint:**

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

**Esempio di risposta:**

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