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

Description

This function restores a configuration backup from a file. If the backup file does not contain any changes, the system does not write to the configuration file.

Examples


 JSON API
https://hostname.example.com:2087/cpsess##########/json-api/restore_config_from_file?api.version=1&module=Main&path=/var/cpanel/cpanel.config
 Command Line
whmapi1 restore_config_from_file module=Main path=/var/cpanel/cpanel.config


Notes:

  • 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":{  
      "command":"restore_config_from_file",
      "reason":"OK",
      "version":1,
      "result":1
   }
}


Note:

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

Parameters

ParameterTypeDescriptionPossible valuesExample
modulestring

Required

The configuration module's name.

A valid string.

Important:

This parameter is case-sensitive. You must enter the parameter in the correct case format; otherwise, the function will fail.

Main
pathstring

Required

The absolute path to configuration file.

A valid path to the WHM server configuration file.

Note:

The file must contain JSON or equals sign-separated key and value pairs on newlines.

/var/cpanel/cpanel.config

Returns

This function only returns metadata.