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

# Окидач

::: info
Окидачи могу да покрену радњу `notification.webhook` која се позива на
[повратни позив](/en/reference/rest-api/webhook) по id-ју
(`{"notification.webhook": {"webhook_id": <id>}}`) уместо, или
упоредо са, `notification.email`. Најпре направите повратни позив, а затим
усмерите радњу (perform) окидача на његов `id`.
:::

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

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

`GET`-Захтев послат: `/api/v1/tickets`

::: details

```json
// HTTP-Code 200 OK

{
  "tags": [
    "order",
    "complaint"
  ]
}

```

:::

::: info
`recipient: "article_last_sender"` шаље имејл ономе ко је написао чланак
који је покренуо окидач. У овом примеру то је увек клијент, јер
услов захтева да `article.sender_id` буде `2` (Customer). Да је оператер
написао чланак, имејл би уместо тога примио оператер. Користите
`recipient: "ticket_customer"` (погледајте Create испод) да увек циљате
клијента, без обзира на то ко је извршио радњу.
:::

## Прикажи

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

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

::: details

```json
// HTTP-Code 200 OK

{
  "id": 2,
  "name": "Agent",
  "preferences": {},
  "default_at_signup": false,
  "active": true,
  "note": "To work on Tickets.",
  "updated_by_id": 3,
  "created_by_id": 1,
  "created_at": "2023-07-26T08:44:37.362Z",
  "updated_at": "2023-08-08T09:59:48.202Z",
  "permission_ids": [
    43,
    57,
    60,
    62,
    66
  ],
  "knowledge_base_permission_ids": [],
  "group_ids": {
    "1": [
      "full"
    ],
    "2": [
      "full"
    ],
    "3": [
      "full"
    ]
  }
}

```

:::

## Креирај

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

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

`condition` прихвата две структуре: раван објекат са кључевима по називу
поља (као у примеру List изнад, што одговара Zammad-овим стандардним
окидачима) и изричит облик `{"operator": "AND", "conditions": [...]}` који
се користи испод.

У примеру испод, затварање тикета доводи до тога да клијент тикета добије
имејл са потврдом, јер се `recipient: "ticket_customer"` увек односи на
клијента, без обзира на то ко је затворио тикет.

:::: details

::: tabs key:reqres

\=== Request

```json
{
  "title": "Help me!",
  "group": "2nd Level",
  "customer": "david@example.com",
  "article": {
    "subject": "My subject",
    "body": "I am a message!",
    "type": "note",
    "sender": "Customer",
    "internal": false
  }
}

```

\=== Response

```json
// HTTP-Code 201 Created

{
  "id": 19,
  "group_id": 2,
  "priority_id": 2,
  "state_id": 1,
  "organization_id": null,
  "number": "22019",
  "title": "Help me!",
  "owner_id": 1,
  "customer_id": 10,
  "note": null,
  "first_response_at": null,
  "first_response_escalation_at": null,
  "first_response_in_min": null,
  "first_response_diff_in_min": null,
  "close_at": null,
  "close_escalation_at": null,
  "close_in_min": null,
  "close_diff_in_min": null,
  "update_escalation_at": null,
  "update_in_min": null,
  "update_diff_in_min": null,
  "last_contact_at": null,
  "last_contact_agent_at": null,
  "last_contact_customer_at": null,
  "last_owner_update_at": null,
  "create_article_type_id": 10,
  "create_article_sender_id": 2,
  "article_count": 1,
  "escalation_at": null,
  "pending_time": null,
  "type": null,
  "time_unit": null,
  "preferences": {},
  "updated_by_id": 3,
  "created_by_id": 3,
  "created_at": "2021-11-08T14:17:41.913Z",
  "updated_at": "2021-11-08T14:17:41.994Z",
  "article_ids": [
    30
  ],
  "ticket_time_accounting_ids": []
}

```

:::

::::

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

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

Послат `PUT` захтев: `/api/v1/users/{id}`

Структура садржаја захтева је иста као код Create. Одговор је освежени
запис, исте структуре као код Show/Create, са освеженим `updated_at`.

::: tip
Ради и делимичан садржај захтева, нпр. `{"active": false}` да промените само
то поље. Да бисте освежили окидач по називу, најпре потражите његов `id` преко
`GET /api/v1/triggers`, а затим пошаљите `PUT` захтев на
`/api/v1/triggers/{id}`.
:::

:::: details

::: tabs key:reqres

\=== Захтев

```json
{
  "phone": "+49 30 55 57 160 00",
  "department": "Sales",
  "address": "Marienstr. 18\n10117 Berlin"
}

```

\=== Одговор

```json
// HTTP-Code 200 OK

{
  "id": 16,
  "organization_id": 5,
  "login": "jdoe",
  "firstname": "Jane",
  "lastname": "Doe",
  "email": "jdoe@example.com",
  "image": null,
  "image_source": null,
  "web": "",
  "phone": "+49 30 55 57 160 00",
  "fax": "",
  "mobile": "",
  "department": "Sales",
  "street": "",
  "zip": "",
  "city": "",
  "country": "",
  "address": "Marienstr. 18\n10117 Berlin",
  "vip": false,
  "verified": false,
  "active": true,
  "note": "",
  "last_login": null,
  "source": null,
  "login_failed": 0,
  "out_of_office": false,
  "out_of_office_start_at": null,
  "out_of_office_end_at": null,
  "out_of_office_replacement_id": null,
  "preferences": {
    "notification_config": {
      "matrix": {
        "create": {
          "criteria": {
            "owned_by_me": true,
            "owned_by_nobody": true,
            "subscribed": true,
            "no": false
          },
          "channel": {
            "email": true,
            "online": true
          }
        },
        "update": {
          "criteria": {
            "owned_by_me": true,
            "owned_by_nobody": true,
            "subscribed": true,
            "no": false
          },
          "channel": {
            "email": true,
            "online": true
          }
        },
        "reminder_reached": {
          "criteria": {
            "owned_by_me": true,
            "owned_by_nobody": false,
            "subscribed": false,
            "no": false
          },
          "channel": {
            "email": true,
            "online": true
          }
        },
        "escalation": {
          "criteria": {
            "owned_by_me": true,
            "owned_by_nobody": false,
            "subscribed": false,
            "no": false
          },
          "channel": {
            "email": true,
            "online": true
          }
        }
      }
    },
    "locale": "en-us"
  },
  "updated_by_id": 3,
  "created_by_id": 3,
  "created_at": "2021-11-03T14:42:36.855Z",
  "updated_at": "2021-11-03T14:49:20.018Z",
  "role_ids": [
    2,
    3
  ],
  "organization_ids": [],
  "authorization_ids": [],
  "karma_user_ids": [],
  "group_ids": {}
}

```

:::

::::

## Обриши

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

::: danger
**Ово је трајно брисање**

Имајте на уму да уклањање окидача не може бити поништено.
:::

Послат `DELETE` захтев: `/api/v1/users/{id}`

::: details

```json
// HTTP-Code 200 OK

{}

```

:::
