[comment]: # ({4a6b3375-4a6b3375})
# hosts.massupdate

[comment]: # ({/4a6b3375-4a6b3375})

[comment]: # ({0949e418-10cbc072})
### Apraksts

`object host.massupdate(object parameters)`

Šī metode ļauj vienlaikus aizstāt vai noņemt saistītos objektus
un atjaunināt īpašības vairākiem hosts.

::: noteclassic
Šī metode ir pieejama tikai *Admin* un *Super admin*
lietotāju tipiem. Tiesības izsaukt šo metodi var atsaukt lietotāja lomas
iestatījumos. Plašāku informāciju skatiet sadaļā [Lietotāju
lomas](/manual/web_interface/frontend_sections/users/user_roles)
:::

[comment]: # ({/0949e418-10cbc072})

[comment]: # ({108bc5bb-6d664071})
### Parametri

`(object)` Parametri, kas satur to hosts ID, kurus jāatjaunina, un īpašības, kas jāatjaunina.

Papildus [standarta host īpašībām](object#host) metode pieņem šādus parametrus.

|Parameter|[Type](/manual/api/reference_commentary#data_types)|Description|
|--|--|------|
|hosts|object/array|[Hosts](/manual/api/reference/host/object), kas jāatjaunina.<br><br>Hosts drīkst būt definēta tikai `hostid` īpašība.<br><br>[Parameter behavior](/manual/api/reference_commentary#parameter-behavior):<br>- *required*|
|groups|object/array|[Host grupas](/manual/api/reference/hostgroup/object), ar kurām aizstāt pašreizējās host grupas, kurām hosts pieder.<br><br>Host grupām drīkst būt definēta tikai `groupid` īpašība.|
|interfaces|object/array|[Host saskarnes](/manual/api/reference/hostinterface/object), ar kurām aizstāt pašreizējās host saskarnes norādītajos hosts.|
|inventory|object|[Host inventāra](/manual/api/reference/host/object#host_inventory) īpašības.<br><br>Host inventāra režīmu nevar atjaunināt, izmantojot `inventory` parametru; tā vietā izmantojiet `inventory_mode`.|
|macros|object/array|[Lietotāja makro](/manual/api/reference/usermacro/object), ar kuriem aizstāt pašreizējos lietotāja makro norādītajos hosts.|
|templates|object/array|[Veidnes](/manual/api/reference/template/object), lai aizstātu pašlaik saistītās veidnes norādītajos hosts.<br><br>Veidnēm drīkst būt definēta tikai `templateid` īpašība.|
|templates\_clear|object/array|[Veidnes](/manual/api/reference/template/object), kuras atsaistīt un notīrīt no norādītajiem hosts.<br><br>Veidnēm drīkst būt definēta tikai `templateid` īpašība.|

[comment]: # ({/108bc5bb-6d664071})

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

`(object)` Atgriež objektu, kas satur atjaunināto hosts ID
`hostids` īpašībā.

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

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

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

[comment]: # ({61c256df-4a8d8b94})
#### Vairāku hosts iespējošana

Iespējojiet divu hosts uzraudzību, tas ir, iestatiet to statusu uz "0".

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

```json
{
    "jsonrpc": "2.0",
    "method": "host.massupdate",
    "params": {
        "hosts": [
            {
                "hostid": "69665"
            },
            {
                "hostid": "69666"
            }
        ],
        "status": 0
    },
    "id": 1
}
```

Atbilde:

```json
{
    "jsonrpc": "2.0",
    "result": {
        "hostids": [
            "69665",
            "69666"
        ]
    },
    "id": 1
}
```

[comment]: # ({/61c256df-4a8d8b94})

[comment]: # ({4b09fb40-4b09fb40})
### Skatīt arī

-   [host.update](update)
-   [host.massadd](massadd)
-   [host.massremove](massremove)
-   [Host grupa](/manual/api/reference/hostgroup/object#host_group)
-   [Veidne](/manual/api/reference/template/object#host_group)
-   [Lietotāja
    makro](/manual/api/reference/usermacro/object#hosttemplate_level_macro)
-   [Host
    saskarne](/manual/api/reference/hostinterface/object#host_interface)

[comment]: # ({/4b09fb40-4b09fb40})

[comment]: # ({ad74e98b-ad74e98b})
### Avots

CHost::massUpdate() *ui/include/classes/api/services/CHost.php*.

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