[comment]: # ({2293b018-2293b018})
# action.get

[comment]: # ({/2293b018-2293b018})

[comment]: # ({4ef8f0ed-42834e1b})
### Apraksts

`integer/array action.get(object parameters)`

Metode ļauj izgūt darbības atbilstoši norādītajiem parametriem.

::: noteclassic
Šī metode ir pieejama jebkura tipa lietotājiem. Atļaujas
izsaukt šo metodi var tikt atsauktas lietotāja lomas iestatījumos. Plašāku informāciju skatiet sadaļā [Lietotāju
lomas](/manual/web_interface/frontend_sections/users/user_roles).
:::

[comment]: # ({/4ef8f0ed-42834e1b})

[comment]: # ({5a2121c5-f6c19c90})
### Parametri

`(object)` Parametri, kas nosaka vēlamo izvadi.

Metode atbalsta šādus parametrus.

|Parametrs|[Tips](/manual/api/reference_commentary#data-types)|Apraksts|
|--|--|------|
|actionids|ID/array|Atgriezt tikai darbības ar norādītajiem ID.|
|groupids|ID/array|Atgriezt tikai darbības, kas darbību nosacījumos izmanto norādītās hostu grupas.|
|hostids|ID/array|Atgriezt tikai darbības, kas darbību nosacījumos izmanto norādītos hostus.|
|triggerids|ID/array|Atgriezt tikai darbības, kas darbību nosacījumos izmanto norādītos trigerus.|
|mediatypeids|ID/array|Atgriezt tikai darbības, kas ziņojumu sūtīšanai izmanto norādītos mediju tipus.|
|usrgrpids|ID/array|Atgriezt tikai darbības, kas ir konfigurētas ziņojumu sūtīšanai norādītajām lietotāju grupām.|
|userids|ID/array|Atgriezt tikai darbības, kas ir konfigurētas ziņojumu sūtīšanai norādītajiem lietotājiem.|
|scriptids|ID/array|Atgriezt tikai darbības, kas ir konfigurētas norādīto skriptu palaišanai.|
|selectFilter|query|Atgriezt [`filter`](/manual/api/reference/action/object#action-filter) īpašību ar darbības nosacījumu filtru.|
|selectOperations|query|Atgriezt [`operations`](/manual/api/reference/action/object#action-operation) īpašību ar darbības operācijām.|
|selectRecoveryOperations|query|Atgriezt [`recovery_operations`](/manual/api/reference/action/object#action-recovery-operation) īpašību ar darbības atkopšanas operācijām.|
|selectUpdateOperations|query|Atgriezt [`update_operations`](/manual/api/reference/action/object#action-update-operation) īpašību ar darbības atjaunināšanas operācijām.|
|sortfield|string/array|Kārtot rezultātu pēc norādītajām īpašībām.<br><br>Iespējamās vērtības: `actionid`, `name`, `status`.|
|countOutput|boolean|Šie parametri ir aprakstīti [atsauces komentārā](/manual/api/reference_commentary#common-get-method-parameters).|
|excludeSearch|boolean|^|
|filter|object|^|
|limit|integer|^|
|output|query|^|
|preservekeys|boolean|^|
|search|object|^|
|searchByAny|boolean|^|
|searchWildcardsEnabled|boolean|^|
|sortorder|string/array|^|
|startSearch|boolean|^|

[comment]: # ({/5a2121c5-f6c19c90})

[comment]: # ({7223bab1-7223bab1})
### Atgrieztās vērtības

`(integer/array)` Atgriež vienu no šīm vērtībām:

-   objektu masīvu;
-   izgūto objektu skaitu, ja ir izmantots parametrs `countOutput`.

[comment]: # ({/7223bab1-7223bab1})

[comment]: # ({b41637d2-b41637d2})
### Piemēri

[comment]: # ({/b41637d2-b41637d2})

[comment]: # ({b12c0d6e-f7d2e806})
#### Iegūt trigeru darbības

Iegūt visas konfigurētās trigeru darbības kopā ar darbību nosacījumiem
un operācijām.

[Pieprasījums](/manual/api#performing-requests):

```json
{
    "jsonrpc": "2.0",
    "method": "action.get",
    "params": {
        "output": "extend",
        "selectOperations": "extend",
        "selectRecoveryOperations": "extend",
        "selectUpdateOperations": "extend",
        "selectFilter": "extend",
        "filter": {
            "eventsource": 0
        }
    },
    "id": 1
}
```

Atbilde:

```json
{
    "jsonrpc": "2.0",
    "result": [
        {
            "actionid": "3",
            "name": "Report problems to Zabbix administrators",
            "eventsource": "0",
            "status": "1",
            "esc_period": "1h",
            "pause_suppressed": "1",
            "filter": {
                "evaltype": "0",
                "formula": "",
                "conditions": [],
                "eval_formula": ""
            },
            "operations": [
                {
                    "operationid": "3",
                    "actionid": "3",
                    "operationtype": "0",
                    "esc_period": "0",
                    "esc_step_from": "1",
                    "esc_step_to": "1",
                    "evaltype": "0",
                    "opconditions": [],
                    "opmessage": [
                        {
                            "default_msg": "1",
                            "subject": "",
                            "message": "",
                            "mediatypeid" => "0"
                        }
                    ],
                    "opmessage_grp": [
                        {
                            "usrgrpid": "7"
                        }
                    ]
                }
            ],
            "recovery_operations": [
                {
                    "operationid": "7",
                    "actionid": "3",
                    "operationtype": "11",
                    "evaltype": "0",
                    "opconditions": [],
                    "opmessage": {
                        "default_msg": "0",
                        "subject": "{TRIGGER.STATUS}: {TRIGGER.NAME}",
                        "message": "Trigeris: {TRIGGER.NAME}\r\nTrigeris statuss: {TRIGGER.STATUS}\r\nTrigeru svarīgums: {TRIGGER.SEVERITY}\r\nTrigeru URL: {TRIGGER.URL}\r\n\r\nVienuma vērtības:\r\n\r\n1. {ITEM.NAME1} ({HOST.NAME1}:{ITEM.KEY1}): {ITEM.VALUE1}\r\n2. {ITEM.NAME2} ({HOST.NAME2}:{ITEM.KEY2}): {ITEM.VALUE2}\r\n3. {ITEM.NAME3} ({HOST.NAME3}:{ITEM.KEY3}): {ITEM.VALUE3}\r\n\r\nSākotnējā notikuma ID: {EVENT.ID}",
                        "mediatypeid": "0"
                    }
                }
            ],
            "update_operations": [
                {
                    "operationid": "31",
                    "operationtype": "12",
                    "evaltype": "0",
                    "opmessage": {
                        "default_msg": "1",
                        "subject": "",
                        "message": "",
                        "mediatypeid": "0"
                    }
                },
                {
                    "operationid": "32",
                    "operationtype": "0",
                    "evaltype": "0",
                    "opmessage": {
                        "default_msg": "0",
                        "subject": "Atjaunināts: {TRIGGER.NAME}",
                        "message": "{USER.FULLNAME} atjaunināja problēmu {EVENT.UPDATE.DATE} {EVENT.UPDATE.TIME} ar šādu ziņojumu:\r\n{EVENT.UPDATE.MESSAGE}\r\n\r\nPašreizējais problēmas statuss ir {EVENT.STATUS}",
                        "mediatypeid": "1"
                    },
                    "opmessage_grp": [
                        {
                            "usrgrpid": "7"
                        }
                    ],
                    "opmessage_usr": []
                },
                {
                    "operationid": "33",
                    "operationtype": "1",
                    "evaltype": "0",
                    "opcommand": {
                        "scriptid": "3"
                    },
                    "opcommand_hst": [
                        {
                            "hostid": "10084"
                        }
                    ],
                    "opcommand_grp": []
                }
            ]
        }
    ],
    "id": 1
}
```

[comment]: # ({/b12c0d6e-f7d2e806})

[comment]: # ({931fc05d-d96da9cf})
#### Atgūt atklāšanas darbības

Atgūst visas konfigurētās atklāšanas darbības kopā ar darbību
nosacījumiem un operācijām. Filtrs izmanto "and" novērtēšanas tipu, tāpēc
rekvizīts `formula` ir tukšs un `eval_formula` tiek ģenerēts
automātiski.

[Pieprasījums](/manual/api#performing-requests):

```json
{
    "jsonrpc": "2.0",
    "method": "action.get",
    "params": {
        "output": "extend",
        "selectOperations": "extend",
        "selectFilter": "extend",
        "filter": {
            "eventsource": 1
        }
    },
    "id": 1
}
```

Atbilde:

```json
{
    "jsonrpc": "2.0",
    "result": [
        {
            "actionid": "2",
            "name": "Auto discovery. Linux servers.",
            "eventsource": "1",
            "status": "1",
            "esc_period": "0s",
            "pause_suppressed": "1",
            "filter": {
                "evaltype": "0",
                "formula": "",
                "conditions": [
                    {
                        "conditiontype": "10",
                        "operator": "0",
                        "value": "0",
                        "value2": "",
                        "formulaid": "B"
                    },
                    {
                        "conditiontype": "8",
                        "operator": "0",
                        "value": "9",
                        "value2": "",
                        "formulaid": "C"
                    },
                    {
                        "conditiontype": "12",
                        "operator": "2",
                        "value": "Linux",
                        "value2": "",
                        "formulaid": "A"
                    }
                ],
                "eval_formula": "A and B and C"
            },
            "operations": [
                {
                    "operationid": "1",
                    "actionid": "2",
                    "operationtype": "6",
                    "esc_period": "0s",
                    "esc_step_from": "1",
                    "esc_step_to": "1",
                    "evaltype": "0",
                    "opconditions": [],
                    "optemplate": [
                        {
                            "templateid": "10001"
                        }
                    ]
                },
                {
                    "operationid": "2",
                    "actionid": "2",
                    "operationtype": "4",
                    "esc_period": "0s",
                    "esc_step_from": "1",
                    "esc_step_to": "1",
                    "evaltype": "0",
                    "opconditions": [],
                    "opgroup": [
                        {
                            "groupid": "2"
                        }
                    ]
                }
            ]
        }
    ],
    "id": 1
}
```

[comment]: # ({/931fc05d-d96da9cf})

[comment]: # ({7ab40057-755496f7})
### Skatīt arī

-   [Darbības filtrs](object#action-filter)
-   [Darbības operācija](object#action-operation)

[comment]: # ({/7ab40057-755496f7})

[comment]: # ({025b824e-025b824e})
### Avots

CAction::get() failā *ui/include/classes/api/services/CAction.php*.

[comment]: # ({/025b824e-025b824e})
