[comment]: # translation:outdated

[comment]: # ({c0df6427-c0df6427})
# hostprototype.update

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

[comment]: # ({89a9f4ab-89a9f4ab})
### Description

`object hostprototype.update(object/array hostPrototypes)`

This method allows to update existing host prototypes.

[comment]: # ({/89a9f4ab-89a9f4ab})

[comment]: # ({e33d3079-39f600d5})
### Parameters

`(object/array)` Host prototype properties to be updated.

The `hostid` property must be defined for each host prototype, all other
properties are optional. Only the passed properties will be updated, all
others will remain unchanged.

Additionally to the [standard host prototype
properties](object#host_prototype), the method accepts the following
parameters.

|Parameter|Type|Description|
|---------|----|-----------|
|groupLinks|array|Group links to replace the current group links on the host prototype.|
|groupPrototypes|array|Group prototypes to replace the existing group prototypes on the host prototype.|
|inventory|object|Host prototype inventory properties.|
|templates|object/array|Templates to replace the currently linked templates.<br><br>The templates must have the `templateid` property defined.|

[comment]: # ({/e33d3079-39f600d5})

[comment]: # ({c97defa2-c97defa2})
### Return values

`(object)` Returns an object containing the IDs of the updated host
prototypes under the `hostids` property.

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

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

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

[comment]: # ({9e34a671-9e34a671})
#### Disabling a host prototype

Disable a host prototype, that is, set its status to 1.

Request:

``` {.java}
{
    "jsonrpc": "2.0",
    "method": "hostprototype.update",
    "params": {
        "hostid": "10092",
        "status": 1
    },
    "auth": "038e1d7b1735c6a5436ee9eae095879e",
    "id": 1
}
```

Response:

``` {.java}
{
    "jsonrpc": "2.0",
    "result": {
        "hostids": [
            "10092"
        ]
    },
    "id": 1
}
```

[comment]: # ({/9e34a671-9e34a671})

[comment]: # ({cf1c169a-749ec170})
### See also

-   [Group link](object#group_link)
-   [Group prototype](object#group_prototype)
-   [Host prototype inventory](object#host_prototype_inventory)

[comment]: # ({/cf1c169a-749ec170})

[comment]: # ({a45ee93f-a380e3fb})
### Source

CHostPrototype::update() in
*frontends/php/include/classes/api/services/CHostPrototype.php*.

[comment]: # ({/a45ee93f-a380e3fb})
