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

# Календар

::: tip
Календар се односи на [израчунавање SLA-а у Zammad-у](/en/reference/rest-api/sla).
:::

## Преглед листе

Потребна дозвола: `admin.calendar`

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

```

:::

## Прикажи

Потребна дозвола: `admin.calendar`

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

:::

## Креирај

Потребна дозвола: `admin.calendar`

`POST`-захтев послат: `/api/v1/calendars`

:::: details

::: tabs key:req-res

\=== Захтев

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

```

\=== Одговор

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

```

:::
::::

## Освежавање

Потребна дозвола: `admin.calendar`

`PUT`-захтев послат: `/api/v1/calendars/{id}`

:::: details

::: tabs key:req-res

\=== Захтев

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

```

\=== Одговор

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

```

:::
::::

## Обриши

Потребна дозвола: `admin.calendar`

`DELETE`-захтев послат: `/api/v1/calendars/{id}`

::: danger

**Ово је трајно уклањање**:

Имајте на уму да се конфигурације календара не могу поништити.

Уклањање календара са референцама у SLA конфигурацијама није могуће
преко API-ја - то ће бити означено као
`"error": "Can't delete, object has references."`. Ово *није* буг.
:::

::: details

```json
// HTTP-Code 200 OK

{}

```

:::
