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

# Smlouvy o úrovni služeb (SLA)

::: tip
SLA závisí na [kalendářích Zammadu](/cs/reference/rest-api/calendar).
:::

## Výpis

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

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

::: details

Odpověď:

```json
// HTTP-Code 200 OK

[
  {
    "id": 2,
    "calendar_id": 1,
    "name": "new sla",
    "first_response_time": 120,
    "response_time": null,
    "update_time": 120,
    "solution_time": 120,
    "condition": {
      "ticket.state_id": {
        "operator": "is",
        "value": "2"
      }
    },
    "updated_by_id": 3,
    "created_by_id": 3,
    "created_at": "2021-11-10T12:54:39.368Z",
    "updated_at": "2021-11-10T12:54:39.368Z"
  }
]

```

:::

## Zobrazení

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

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

::: details

```json
// HTTP-Code 200 OK

{
  "id": 2,
  "calendar_id": 1,
  "name": "new sla",
  "first_response_time": 120,
  "response_time": null,
  "update_time": 120,
  "solution_time": 120,
  "condition": {
    "ticket.state_id": {
      "operator": "is",
      "value": "2"
    }
  },
  "updated_by_id": 3,
  "created_by_id": 3,
  "created_at": "2021-11-10T12:54:39.368Z",
  "updated_at": "2021-11-10T12:54:39.368Z"
}

```

:::

## Vytvoření

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

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

:::: details

::: tabs key:reqres

\=== Požadavek

```json
{
  "name": "new sla",
  "first_response_time": "120",
  "response_time": "",
  "update_time": "120",
  "solution_time": "120",
  "condition": {
    "ticket.state_id": {
      "operator": "is",
      "value": "2"
    }
  },
  "calendar_id": "1"
}

```

\=== Odpověď

```json
// HTTP-Code 201 Created

{
  "id": 2,
  "calendar_id": 1,
  "name": "new sla",
  "first_response_time": 120,
  "response_time": null,
  "update_time": 120,
  "solution_time": 120,
  "condition": {
    "ticket.state_id": {
      "operator": "is",
      "value": "2"
    }
  },
  "updated_by_id": 3,
  "created_by_id": 3,
  "created_at": "2021-11-10T12:54:39.368Z",
  "updated_at": "2021-11-10T12:54:39.368Z"
}

```

:::
::::

## Aktualizace

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

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

:::: details

::: tabs key:reqres

\=== Požadavek

```json
{
  "name": "update sla",
  "first_response_time": "120",
  "response_time": "",
  "update_time": "120",
  "solution_time": "120",
  "condition": {
    "ticket.state_id": {
      "operator": "is",
      "value": "2"
    }
  },
  "calendar_id": "1",
  "id": 2
}

```

\=== Odpověď

```json
// HTTP-Code 200 OK

{
  "id": 2,
  "calendar_id": 1,
  "name": "update sla",
  "first_response_time": 120,
  "response_time": null,
  "update_time": 120,
  "solution_time": 120,
  "condition": {
    "ticket.state_id": {
      "operator": "is",
      "value": "2"
    }
  },
  "updated_by_id": 3,
  "created_by_id": 3,
  "created_at": "2021-11-10T12:54:39.368Z",
  "updated_at": "2021-11-10T13:02:52.053Z"
}

```

:::
::::

## Smazání

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

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

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

Odstranění konfigurací SLA nelze vrátit zpět.
:::

::: details

Odpověď:

```json
// HTTP-Code 200 OK

{}

```

:::
