# Referință API pentru anunțurile generale

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

Anunțurile generale sunt bannere permanente afișate pe pagina ta de stare (separate de incidente și mentenanțe). Folosește aceste endpointuri ca să le gestionezi programatic.

## Obține toate anunțurile generale

**Endpoint:**

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

- Numărul implicit al paginii este 1.
- Valoarea implicită pentru per_page este 50, iar maximul este 100 de elemente pe pagină.

**Exemplu de răspuns:**

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

## Obține un anunț general

**Endpoint:**

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

**Exemplu de răspuns:**

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

## Adaugă un anunț general

**Endpoint:**

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

**Parametri din corp:**

- `name` (obligatoriu) — titlul anunțului.
- `message` — corpul anunțului. HTML este acceptat.
- `notify` — dacă să fie anunțați abonații. Valoarea implicită este `false`.
- `isCollapsed` — dacă anunțul este restrâns implicit. Valoarea implicită este `false`.
- `translations` — traduceri opționale pentru `name` și `message`, indexate după codul de limbă.

**Exemplu de cerere:**

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

**Exemplu de răspuns:**

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

## Actualizează un anunț general

**Endpoint:**

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

Se actualizează doar câmpurile pe care le trimiți.

**Exemplu de cerere:**

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

**Exemplu de răspuns:**

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

## Șterge un anunț general

**Endpoint:**

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

**Exemplu de răspuns:**

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