[comment]: # ({4a6b3375-4a6b3375})
# host.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 vairāku hosts īpašības.

::: 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]: # ({472b2d62-6d664071})
### Parametri

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

Papildus [standarta hosts ī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) atjaunināšanai.<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 groups](/manual/api/reference/hostgroup/object), ar ko aizstāt pašreizējās host grupas, kurām hosts pieder.<br><br>Host groups drīkst būt definēta tikai `groupid` īpašība.|
|interfaces|object/array|[Host interfaces](/manual/api/reference/hostinterface/object), ar ko aizstāt pašreizējās host interfaces norādītajiem hosts.|
|inventory|object|[Host inventory](/manual/api/reference/host/object#host-inventory) īpašības.<br><br>Host inventory režīmu nevar atjaunināt, izmantojot `inventory` parametru; tā vietā izmantojiet `inventory_mode`.|
|macros|object/array|[User macros](/manual/api/reference/usermacro/object), ar ko aizstāt pašreizējās lietotāja macros norādītajiem hosts.|
|templates|object/array|[Templates](/manual/api/reference/template/object), lai aizstātu pašlaik piesaistītās templates norādītajiem hosts.<br><br>Templates drīkst būt definēta tikai `templateid` īpašība.|
|templates\_clear|object/array|[Templates](/manual/api/reference/template/object), ko atsaistīt un noņemt no norādītajiem hosts.<br><br>Templates drīkst būt definēta tikai `templateid` īpašība.|

[comment]: # ({/472b2d62-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]: # ({fd067297-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
    interfeiss](/manual/api/reference/hostinterface/object#host-interface)

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

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

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

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