[comment]: # translation:outdated

[comment]: # ({cd91b3fe-cd91b3fe})
# script.get

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

[comment]: # ({ce6433f5-96ec37bc})
### Опис

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

Ова метода омогућава преузимање скрипти према датим параметрима.

::: noteclassic
Овај метод је доступан корисницима било које врсте. Дозволе
за позивање методе може се опозвати у подешавањима улоге корисника. Погледајте [Корисничке
улоге](/manual/web_interface/frontend_sections/users/user_roles)
за више информација.
:::

[comment]: # ({/ce6433f5-96ec37bc})

[comment]: # ({a4b22b8c-c425a65a})
### Параметри

`(object)` Параметри који дефинишу жељени излаз.

Метод подржава следеће параметре.

|Parameter|[Type](/manual/api/reference_commentary#data_types)|Description|
|--|--|------|
|groupids|ID/array|Враћа само скрипте које се могу покренути на датим групама домаћина.|
|hostids|ID/array|Враћа само скрипте које се могу покренути на датим домаћинима.|
|scriptids|ID/array|Враћа само скрипте са датим ID-ијевима.|
|usrgrpids|ID/array|Враћа само скрипте које могу да покрећу корисници у датим групама корисника.|
|сselectHostGroups|query|Враћа својство [`hostgroups `](/manual/api/reference/hostgroup/object) са групама домаћина на којима се скрипта може покренути.|
|selectHosts|query|Враћа својство [`hosts`](/manual/api/reference/host/object) са домаћинима на којима се скрипта може покренути.|
|selectActions|query|Враћа својство [`actions`](/manual/api/reference/action/object) са акцијама са којима је скрипта повезана.|
|sortfield|string/array|Сортирај резултат према датим особинама.<br><br>Могуће вредности: `scriptid`, `name`.|
|countOutput|boolean|Ови параметри који су заједнички за све `get` методе су детаљно описани у [референтном коментару](/manual/api/reference_commentary#common_get_method_parameters).|
|editable|boolean|^|
|excludeSearch|boolean|^|
|filter|object|^|
|limit|integer|^|
|output|query|^|
|preservekeys|boolean|^|
|search|object|^|
|searchByAny|boolean|^|
|searchWildcardsEnabled|boolean|^|
|sortorder|string/array|^|
|startSearch|boolean|^|

[comment]: # ({/a4b22b8c-c425a65a})

[comment]: # ({7223bab1-7223bab1})
### Повратне вредности

`(integer/array)` Враћа било:

-    низ објеката;
-    број преузетих објеката, ако је параметар `countOutput` 
коришћен.

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

[comment]: # ({b41637d2-b41637d2})
### Примери

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

[comment]: # ({04ad24fc-6d428f32})
#### Преузимање свих скрипти

Преузмите све конфигурисане скрипте.

[Захтев](/manual/api#performing-requests):

```json
{
    "jsonrpc": "2.0",
    "method": "script.get",
    "params": {
        "output": "extend"
    },
    "id": 1
}
```

Одговор:

```json
{
    "jsonrpc": "2.0",
    "result": [
        {
            "scriptid": "1",
            "name": "Ping",
            "command": "/bin/ping -c 3 {HOST.CONN} 2>&1",
            "host_access": "2",
            "usrgrpid": "0",
            "groupid": "0",
            "description": "",
            "confirmation": "",
            "type": "0",
            "execute_on": "1",
            "timeout": "30s",
            "scope": "2",
            "port": "",
            "authtype": "0",
            "username": "",
            "password": "",
            "publickey": "",
            "privatekey": "",
            "menu_path": "",
            "url": "",
            "new_window": "1",
            "manualinput": "0",
            "manualinput_prompt": "",
            "manualinput_validator": "",
            "manualinput_validator_type": "0",
            "manualinput_default_value": "",
            "parameters": []
        },
        {
            "scriptid": "2",
            "name": "Traceroute",
            "command": "/usr/bin/traceroute {HOST.CONN} 2>&1",
            "host_access": "2",
            "usrgrpid": "0",
            "groupid": "0",
            "description": "",
            "confirmation": "",
            "type": "0",
            "execute_on": "1",
            "timeout": "30s",
            "scope": "2",
            "port": "",
            "authtype": "0",
            "username": "",
            "password": "",
            "publickey": "",
            "privatekey": "",
            "menu_path": "",
            "url": "",
            "new_window": "1",
            "manualinput": "0",
            "manualinput_prompt": "",
            "manualinput_validator": "",
            "manualinput_validator_type": "0",
            "manualinput_default_value": "",
            "parameters": []
        },
        {
            "scriptid": "3",
            "name": "Detect operating system",
            "command": "sudo /usr/bin/nmap -O {HOST.CONN} 2>&1",
            "host_access": "2",
            "usrgrpid": "7",
            "groupid": "0",
            "description": "",
            "confirmation": "",
            "type": "0",
            "execute_on": "1",
            "timeout": "30s",
            "scope": "2",
            "port": "",
            "authtype": "0",
            "username": "",
            "password": "",
            "publickey": "",
            "privatekey": "",
            "menu_path": "",
            "url": "",
            "new_window": "1",
            "manualinput": "0",
            "manualinput_prompt": "",
            "manualinput_validator": "",
            "manualinput_validator_type": "0",
            "manualinput_default_value": "",
            "parameters": []
        },
        {
            "scriptid": "4",
            "name": "Webhook",
            "command": "try {\n var request = new HttpRequest(),\n response,\n data;\n\n request.addHeader('Content-Type: application/json');\n\n response = request.post('https://localhost/post', value);\n\n try {\n response = JSON.parse(response);\n }\n catch (error) {\n response = null;\n }\n\n if (request.getStatus() !== 200 || !('data' in response)) {\n throw 'Unexpected response.';\n }\n\n data = JSON.stringify(response.data);\n\n Zabbix.log(3, '[Webhook Script] response data: ' + data);\n\n return data;\n}\ncatch (error) {\n Zabbix.log(3, '[Webhook Script] script execution failed: ' + error);\n throw 'Execution failed: ' + error + '.';\n}",
            "host_access": "2",
            "usrgrpid": "7",
            "groupid": "0",
            "description": "",
            "confirmation": "",
            "type": "5",
            "execute_on": "1",
            "timeout": "30s",
            "scope": "2",
            "port": "",
            "authtype": "0",
            "username": "",
            "password": "",
            "publickey": "",
            "privatekey": "",
            "menu_path": "",
            "url": "",
            "new_window": "1",
            "manualinput": "0",
            "manualinput_prompt": "",
            "manualinput_validator": "",
            "manualinput_validator_type": "0",
            "manualinput_default_value": "",
            "parameters": [
                {
                    "name": "token",
                    "value": "{$WEBHOOK.TOKEN}"
                },
                {
                    "name": "host",
                    "value": "{HOST.HOST}"
                },
                {
                    "name": "v",
                    "value": "2.2"
                }
            ]
        },
        {
            "scriptid": "5",
            "name": "URL",
            "command": "",
            "host_access": "2",
            "usrgrpid": "0",
            "groupid": "0",
            "description": "",
            "confirmation": "Go to {HOST.NAME}?",
            "type": "6",
            "execute_on": "1",
            "timeout": "30s",
            "scope": "4",
            "port": "",
            "authtype": "0",
            "username": "",
            "password": "",
            "publickey": "",
            "privatekey": "",
            "menu_path": "",
            "url": "http://zabbix/ui/zabbix.php?action=latest.view&hostids[]={HOST.ID}",
            "new_window": "0",
            "manualinput": "0",
            "manualinput_prompt": "",
            "manualinput_validator": "",
            "manualinput_validator_type": "0",
            "manualinput_default_value": "",
            "parameters": []
        },
        {
            "scriptid": "6",
            "name": "URL with user input",
            "command": "",
            "host_access": "2",
            "usrgrpid": "0",
            "groupid": "0",
            "description": "",
            "confirmation": "Open zabbix page {MANUALINPUT}?",
            "type": "6",
            "execute_on": "1",
            "timeout": "30s",
            "scope": "2",
            "port": "",
            "authtype": "0",
            "username": "",
            "password": "",
            "publickey": "",
            "privatekey": "",
            "menu_path": "",
            "url": "http://zabbix/ui/zabbix.php?action={MANUALINPUT}",
            "new_window": "0",
            "manualinput": "1",
            "manualinput_prompt": "Select a page to open:",
            "manualinput_validator": "dashboard.view,script.list,actionlog.list",
            "manualinput_validator_type": "1",
            "parameters": []
        }
    ],
    "id": 1
}
```

[comment]: # ({/04ad24fc-6d428f32})

[comment]: # ({b0b740ec-b0b740ec})
### Погледајте такође

-  [Домаћин](/manual/api/reference/host/object#object_details)
-  [Група домаћина](/manual/api/reference/hostgroup/object#object_details)

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

[comment]: # ({90dfc753-90dfc753})
### Извор

CScript::get() у *ui/include/classes/api/services/CScript.php*.

[comment]: # ({/90dfc753-90dfc753})
