[comment]: # ({92a86fab-92a86fab})
# proxy.update

[comment]: # ({/92a86fab-92a86fab})

[comment]: # ({381a99b9-381a99b9})
### Description

`object proxy.update(object/array proxies)`

This method allows to update existing proxies.

::: noteclassic
This method is only available to *Super admin* user type.
Permissions to call the method can be revoked in user role settings. See
[User
roles](/manual/web_interface/frontend_sections/administration/user_roles)
for more information.
:::

[comment]: # ({/381a99b9-381a99b9})

[comment]: # ({4d6a0721-4d6a0721})
### Parameters

`(object/array)` Proxy properties to be updated.

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

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

|Parameter|[Type](/manual/api/reference_commentary#data_types)|Description|
|---------|---------------------------------------------------|-----------|
|hosts|array|[Hosts](/manual/api/reference/host/object) to be monitored by the proxy. If a host is already monitored by a different proxy, it will be reassigned to the current proxy.<br><br>The hosts must have the `hostid` property defined.|
|interface|object|Host [interface](/manual/api/reference/hostinterface/object) to replace the existing interface for the passive proxy.|

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

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

`(object)` Returns an object containing the IDs of the updated proxies
under the `proxyids` property.

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

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

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

[comment]: # ({dcc48cfa-dcc48cfa})
#### Change hosts monitored by a proxy

Update the proxy to monitor the two given hosts.

Request:

``` {.java}
{
    "jsonrpc": "2.0",
    "method": "proxy.update",
    "params": {
        "proxyid": "10293",
        "hosts": [
            "10294",
            "10295"
        ]
    },
    "auth": "038e1d7b1735c6a5436ee9eae095879e",
    "id": 1
}
```

Response:

``` {.java}
{
    "jsonrpc": "2.0",
    "result": {
        "proxyids": [
            "10293"
        ]
    },
    "id": 1
}
```

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

[comment]: # ({f06b99dc-f06b99dc})
#### Change proxy status

Change the proxy to an active proxy and rename it to "Active proxy".

Request:

``` {.java}
{
    "jsonrpc": "2.0",
    "method": "proxy.update",
    "params": {
        "proxyid": "10293",
        "host": "Active proxy",
        "status": "5"
    },
    "auth": "038e1d7b1735c6a5436ee9eae095879e",
    "id": 1
}
```

Response:

``` {.java}
{
    "jsonrpc": "2.0",
    "result": {
        "proxyids": [
            "10293"
        ]
    },
    "id": 1
}
```

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

[comment]: # ({273e0fd8-273e0fd8})
### See also

-   [Host](/manual/api/reference/host/object#host)
-   [Proxy interface](object#proxy_interface)

[comment]: # ({/273e0fd8-273e0fd8})

[comment]: # ({8237a78a-8237a78a})
### Source

CProxy::update() in *ui/include/classes/api/services/CProxy.php*.

[comment]: # ({/8237a78a-8237a78a})
