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.

ParameterTypeDescription
hostsarrayHosts 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 the hostid property defined.
interfaceobjectHost interface to replace the existing interface for the passive proxy.

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:

  1. {
  2. "jsonrpc": "2.0",
  3. "method": "proxy.update",
  4. "params": {
  5. "proxyid": "10293",
  6. "hosts": [
  7. "10294",
  8. "10295"
  9. ]
  10. },
  11. "auth": "038e1d7b1735c6a5436ee9eae095879e",
  12. "id": 1
  13. }

Response:

  1. {
  2. "jsonrpc": "2.0",
  3. "result": {
  4. "proxyids": [
  5. "10293"
  6. ]
  7. },
  8. "id": 1
  9. }

Change proxy status

Change the proxy to an active proxy and rename it to “Active proxy”.

Request:

  1. {
  2. "jsonrpc": "2.0",
  3. "method": "proxy.update",
  4. "params": {
  5. "proxyid": "10293",
  6. "host": "Active proxy",
  7. "status": "5"
  8. },
  9. "auth": "038e1d7b1735c6a5436ee9eae095879e",
  10. "id": 1
  11. }

Response:

  1. {
  2. "jsonrpc": "2.0",
  3. "result": {
  4. "proxyids": [
  5. "10293"
  6. ]
  7. },
  8. "id": 1
  9. }

See also

Source

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