We have a new documentation site for cPanel & WHM! You can find our new documentation site at docs.cpanel.net.

We will continue to maintain our API documentation on this server.

Child pages
  • WHM API 1 Functions - set_service_proxy_backends
Skip to end of metadata
Go to start of metadata

Description

This function lets you configure a cPanel account's service proxying.

Note:

  • If the WebServer role is active on the server, this function rebuilds the user's web virtual hosts (vhosts) and restarts the web server. For more information about server roles, read our How to Use Server Profiles documentation.
  • If the system cannot rebuild the user's vhosts, the API call will still succeed. However, the function returns a failure warning in the metadata.
  • To remove an account's service proxying, use the WHM API 1 unset_all_service_proxy_backends function.

Examples


 JSON API
https://hostname.example.com:2087/cpsess##########/json-api/set_service_proxy_backends?api.version=1&username=example&general=hostname.example.com&service_group=Mail&service_group_backend=mail.example.com
 Command Line
whmapi1 set_service_proxy_backends username=example general=hostname.example.com service_group=Mail service_group_backend=mail.example.com


Notes:

  • Unless otherwise noted, you must URI-encode values.
  • For more information and additional output options, read our Guide to WHM API 1 documentation or run the whmapi1 --help command.
  • If you run CloudLinux™, you must use the full path of the whmapi1 command:

    /usr/local/cpanel/bin/whmapi1

 Output (JSON)
{
   "metadata" : {
      "version" : 1,
      "result" : 1,
      "reason" : "OK",
      "command" : "set_service_proxy_backends"
   }
}


Note:

Use WHM's API Shell interface (WHM >> Home >> Development >> API Shell) to directly test WHM API calls.

Parameters

ParameterTypeDescriptionPossible valuesExample
usernamestring

Required

The cPanel account's username.

A valid username.

example
generalstring

The hostname or IP address to assign as the server that handles the account's service proxy requests.

This parameter defaults to the existing service proxy configuration, if any exist.

A valid hostname or IP address.hostname.example.com
service_groupstring

The name of a service group for which to assign a proxy backend. The corresponding service_group_backend value will be the service group's new proxy backend.

Note:

  • When you call this parameter, you must include a corresponding service_group_backend value.
  • To add multiple service_group values, increment the parameter name. For example, use the service_group-1, service_group-2, and service_group-3 parameters.

This parameter defaults to the existing setting, if one exists.

Mail

Mail
service_group_backend string

The hostname or IP address of the server to assign as the corresponding service_group value's proxy backend server .

Note:

  • When you call this parameter, you must include a corresponding service_group value.
  • To add multiple service_group_backend  values, increment the parameter name. For example, use the service_group_backend-1service_group_backend-2, and service_group_backend-3 parameters.

This parameter defaults to the existing setting, if one exists.

A valid hostname or IP address.mail.example.com

Returns

This function only returns metadata.