---
url: https://next.zammad.org/cs/reference/rest-api/calendar.md
---

# Kalendář

::: tip
Kalendáře jsou součástí [výpočtu SLA v Zammadu](/cs/reference/rest-api/sla).
:::

## Výpis

Požadované oprávnění: `admin.calendar`

Odeslaný požadavek `GET`: `/api/v1/calendars`

::: details

```json
// HTTP-Code 200 OK

[
  {
    "id": 2,
    "name": "Test calendar",
    "timezone": "Europe/Berlin",
    "business_hours": {
      "mon": {
        "active": true,
        "timeframes": [
          [
            "09:00",
            "17:00"
          ]
        ]
      },
      "tue": {
        "active": true,
        "timeframes": [
          [
            "09:00",
            "17:00"
          ]
        ]
      },
      "wed": {
        "active": true,
        "timeframes": [
          [
            "09:00",
            "17:00"
          ]
        ]
      },
      "thu": {
        "active": true,
        "timeframes": [
          [
            "09:00",
            "17:00"
          ]
        ]
      },
      "fri": {
        "active": true,
        "timeframes": [
          [
            "09:00",
            "17:00"
          ]
        ]
      },
      "sat": {
        "active": false,
        "timeframes": [
          [
            "10:00",
            "14:00"
          ]
        ]
      },
      "sun": {
        "active": false,
        "timeframes": [
          [
            "10:00",
            "14:00"
          ]
        ]
      }
    },
    "default": false,
    "ical_url": "",
    "public_holidays": {
      "2021-11-10": {
        "active": true,
        "summary": "Feast day 1"
      },
      "2021-11-11": {
        "active": true,
        "summary": "Feast day 2"
      }
    },
    "last_log": null,
    "last_sync": "2021-11-10T13:14:20.835Z",
    "updated_by_id": 3,
    "created_by_id": 3,
    "created_at": "2021-11-10T13:14:20.835Z",
    "updated_at": "2021-11-10T13:14:20.835Z"
  }
]

```

:::

## Zobrazení

Požadované oprávnění: `admin.calendar`

Odeslaný požadavek `GET`: `/api/v1/calendars/{id}`

::: details

```json
// HTTP-Code 200 OK

{
  "id": 2,
  "name": "Test calendar",
  "timezone": "Europe/Berlin",
  "business_hours": {
    "mon": {
      "active": true,
      "timeframes": [
        [
          "09:00",
          "17:00"
        ]
      ]
    },
    "tue": {
      "active": true,
      "timeframes": [
        [
          "09:00",
          "17:00"
        ]
      ]
    },
    "wed": {
      "active": true,
      "timeframes": [
        [
          "09:00",
          "17:00"
        ]
      ]
    },
    "thu": {
      "active": true,
      "timeframes": [
        [
          "09:00",
          "17:00"
        ]
      ]
    },
    "fri": {
      "active": true,
      "timeframes": [
        [
          "09:00",
          "17:00"
        ]
      ]
    },
    "sat": {
      "active": false,
      "timeframes": [
        [
          "10:00",
          "14:00"
        ]
      ]
    },
    "sun": {
      "active": false,
      "timeframes": [
        [
          "10:00",
          "14:00"
        ]
      ]
    }
  },
  "default": false,
  "ical_url": "",
  "public_holidays": {
    "2021-11-10": {
      "active": true,
      "summary": "Feast day 1"
    },
    "2021-11-11": {
      "active": true,
      "summary": "Feast day 2"
    }
  },
  "last_log": null,
  "last_sync": "2021-11-10T13:14:20.835Z",
  "updated_by_id": 3,
  "created_by_id": 3,
  "created_at": "2021-11-10T13:14:20.835Z",
  "updated_at": "2021-11-10T13:14:20.835Z"
}
```

:::

## Vytvoření

Požadované oprávnění: `admin.calendar`

Odeslaný požadavek `POST`: `/api/v1/calendars`

:::: details

::: tabs key:req-res

\=== Požadavek

```json
{
  "name": "Test calendar",
  "timezone": "Europe/Berlin",
  "business_hours": {
    "mon": {
      "active": true,
      "timeframes": [
        [
          "09:00",
          "17:00"
        ]
      ]
    },
    "tue": {
      "active": true,
      "timeframes": [
        [
          "09:00",
          "17:00"
        ]
      ]
    },
    "wed": {
      "active": true,
      "timeframes": [
        [
          "09:00",
          "17:00"
        ]
      ]
    },
    "thu": {
      "active": true,
      "timeframes": [
        [
          "09:00",
          "17:00"
        ]
      ]
    },
    "fri": {
      "active": true,
      "timeframes": [
        [
          "09:00",
          "17:00"
        ]
      ]
    },
    "sat": {
      "active": false,
      "timeframes": [
        [
          "10:00",
          "14:00"
        ]
      ]
    },
    "sun": {
      "active": false,
      "timeframes": [
        [
          "10:00",
          "14:00"
        ]
      ]
    }
  },
  "ical_url": "",
  "public_holidays": {
    "2021-11-10": {
      "active": true,
      "summary": "Feast day 1"
    },
    "2021-11-11": {
      "active": true,
      "summary": "Feast day 2"
    }
  },
  "note": "",
  "id": "c-1"
}

```

\=== Odpověď

```json
// HTTP-Code 201 Created

{
  "id": 2,
  "name": "Test calendar",
  "timezone": "Europe/Berlin",
  "business_hours": {
    "mon": {
      "active": true,
      "timeframes": [
        [
          "09:00",
          "17:00"
        ]
      ]
    },
    "tue": {
      "active": true,
      "timeframes": [
        [
          "09:00",
          "17:00"
        ]
      ]
    },
    "wed": {
      "active": true,
      "timeframes": [
        [
          "09:00",
          "17:00"
        ]
      ]
    },
    "thu": {
      "active": true,
      "timeframes": [
        [
          "09:00",
          "17:00"
        ]
      ]
    },
    "fri": {
      "active": true,
      "timeframes": [
        [
          "09:00",
          "17:00"
        ]
      ]
    },
    "sat": {
      "active": false,
      "timeframes": [
        [
          "10:00",
          "14:00"
        ]
      ]
    },
    "sun": {
      "active": false,
      "timeframes": [
        [
          "10:00",
          "14:00"
        ]
      ]
    }
  },
  "default": false,
  "ical_url": "",
  "public_holidays": {
    "2021-11-10": {
      "active": true,
      "summary": "Feast day 1"
    },
    "2021-11-11": {
      "active": true,
      "summary": "Feast day 2"
    }
  },
  "last_log": null,
  "last_sync": "2021-11-10T13:14:20.835Z",
  "updated_by_id": 3,
  "created_by_id": 3,
  "created_at": "2021-11-10T13:14:20.835Z",
  "updated_at": "2021-11-10T13:14:20.835Z"
}

```

:::
::::

## Aktualizace

Požadované oprávnění: `admin.calendar`

Odeslaný požadavek `PUT`: `/api/v1/calendars/{id}`

:::: details

::: tabs key:req-res

\=== Požadavek

```json
{
  "name": "Test calendar Update",
  "timezone": "Europe/Berlin",
  "default": false,
  "business_hours": {
    "mon": {
      "active": true,
      "timeframes": [
        [
          "09:00",
          "17:00"
        ]
      ]
    },
    "tue": {
      "active": true,
      "timeframes": [
        [
          "09:00",
          "17:00"
        ]
      ]
    },
    "wed": {
      "active": true,
      "timeframes": [
        [
          "09:00",
          "17:00"
        ]
      ]
    },
    "thu": {
      "active": true,
      "timeframes": [
        [
          "09:00",
          "17:00"
        ]
      ]
    },
    "fri": {
      "active": true,
      "timeframes": [
        [
          "09:00",
          "17:00"
        ]
      ]
    },
    "sat": {
      "active": false,
      "timeframes": [
        [
          "10:00",
          "14:00"
        ]
      ]
    },
    "sun": {
      "active": false,
      "timeframes": [
        [
          "10:00",
          "14:00"
        ]
      ]
    }
  },
  "ical_url": "",
  "public_holidays": {
    "2021-11-10": {
      "active": true,
      "summary": "Feast day 1"
    },
    "2021-11-11": {
      "active": true,
      "summary": "Feast day 2"
    }
  },
  "note": "",
  "id": 2
}

```

\=== Odpověď

```json
// HTTP-Code 200 OK

{
  "id": 2,
  "name": "Test calendar Update",
  "timezone": "Europe/Berlin",
  "default": false,
  "ical_url": "",
  "business_hours": {
    "mon": {
      "active": true,
      "timeframes": [
        [
          "09:00",
          "17:00"
        ]
      ]
    },
    "tue": {
      "active": true,
      "timeframes": [
        [
          "09:00",
          "17:00"
        ]
      ]
    },
    "wed": {
      "active": true,
      "timeframes": [
        [
          "09:00",
          "17:00"
        ]
      ]
    },
    "thu": {
      "active": true,
      "timeframes": [
        [
          "09:00",
          "17:00"
        ]
      ]
    },
    "fri": {
      "active": true,
      "timeframes": [
        [
          "09:00",
          "17:00"
        ]
      ]
    },
    "sat": {
      "active": false,
      "timeframes": [
        [
          "10:00",
          "14:00"
        ]
      ]
    },
    "sun": {
      "active": false,
      "timeframes": [
        [
          "10:00",
          "14:00"
        ]
      ]
    }
  },
  "public_holidays": {
    "2021-11-10": {
      "active": true,
      "summary": "Feast day 1"
    },
    "2021-11-11": {
      "active": true,
      "summary": "Feast day 2"
    }
  },
  "updated_by_id": 3,
  "last_log": null,
  "last_sync": "2021-11-10T13:23:07.455Z",
  "created_by_id": 3,
  "created_at": "2021-11-10T13:14:20.835Z",
  "updated_at": "2021-11-10T13:23:07.455Z"
}

```

:::
::::

## Smazání

Požadované oprávnění: `admin.calendar`

Odeslaný požadavek `DELETE`: `/api/v1/calendars/{id}`

::: danger

**Jde o trvalé odstranění**:

Odstranění konfigurací kalendářů nelze vrátit zpět.

Kalendáře s odkazy v konfiguracích SLA nelze odstranit
přes API – signalizuje to
`"error": "Can't delete, object has references."`. *Nejde* o chybu.
:::

::: details

```json
// HTTP-Code 200 OK

{}

```

:::
