proxy.update

Description

object proxy.update(object/array proxies)

This method allows to update existing proxies.

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 for more information.

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, the method accepts the following parameters.

Parameter Type Description
hosts array Hosts to be monitored by the proxy.
If a host is already monitored by a different proxy, it will be reassigned to the current proxy.

The hosts must have only the hostid property defined.

Return values

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

Examples

Change hosts monitored by a proxy

Update the proxy to monitor the two given hosts.

Request:

{
           "jsonrpc": "2.0",
           "method": "proxy.update",
           "params": {
               "proxyid": "10293",
               "hosts": [
                   {
                       "hostid": "10294"
                   },
                   {
                       "hostid": "10295"
                   },
               ]
           },
           "id": 1
       }

Response:

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

Change proxy status

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

Request:

{
           "jsonrpc": "2.0",
           "method": "proxy.update",
           "params": {
               "proxyid": "10293",
               "name": "Active proxy",
               "operating_mode": "0"
           },
           "id": 1
       }

Response:

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

Add a proxy to a proxy group

Update proxy with ID "5" and add it to proxy group with ID "1".

Request:

{
           "jsonrpc": "2.0",
           "method": "proxy.create",
           "params": {
               "proxyid": "5",
               "proxy_groupid": "1",
               "local_address": "127.0.0.1"
           },
           "id": 1
       }

Response:

{
           "jsonrpc": "2.0",
           "result": {
               "proxyids": [
                   "5"
               ]
           },
           "id": 1
       }

See also

Source

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