Add Site Publisher website

This function publishes a Site Publisher website.

  • This function uses the /scripts/process_site_template script to publish the Site Publisher website.
  • This function creates the configurations.json file in the specified directory.
    • This file contains the user-entered data for the Site Publisher website and uses 0700 permissions.
    • For more information, read our Guide to Site Publisher Templates documentation.
  • When users publish a Site Publisher website, the system first creates a backup tarball of the target directory's contents in the /site_publisher/backups/ directory within the user's home directory.

Notes:

  • When users publish a Site Publisher website, the system logs template information and the target directory to the /usr/local/cpanel/logs/error_log file.
  • The template directory's location depends on whether the root user or a reseller owns the template:
    • /var/cpanel/customizations/site_templates/ — The root user's templates.
    • /home/username/var/cpanel/reseller/site_templates/ — A reseller's templates, where username represents the reseller's username.
    • /usr/local/cpanel/3rdparty/share/site_templates/ — cPanel-provided templates.

Important:

When you disable the Web Server role, the system disables this function.

SecurityBasicAuth
Request
query Parameters
target or docroot
required
string <path>

The directory that will contain the Site Publisher website.

Example: target or docroot=/home/example/public_html
parameter_name
string

The template's variables and values.

Note:

  • Use each variable's name as a parameter name for a parameter and value pair.
  • The template that you specify determines the values to define.
  • You must include the appropriate data for the selected template. If you use a cPanel-provided template, read our Guide to Site Publisher Templates documentation for more information. If you use a third-party template, consult that template's documentation or its meta.json file.
Example: parameter_name=My Website
path
string <path>

The directory that contains the template's source directory.

  • /var/cpanel/customizations/site_templates/ — The root user's templates.
  • /home/username/var/cpanel/reseller/site_templates/ — A reseller's templates, where username represents the reseller's username.
  • /usr/local/cpanel/3rdparty/share/site_templates/ — cPanel-provided templates.

Note:

You must include either the source parameter or the path and template parameters.

Example: path=/usr/local/cpanel/3rdparty/share/site_templates/
source
string <path>

The absolute path to a template directory that exists in one of the following directories:

  • /var/cpanel/customizations/site_templates/ — The root user's templates.
  • /home/username/var/cpanel/reseller/site_templates/ — A reseller's templates, where username represents the reseller's username.
  • /usr/local/cpanel/3rdparty/share/site_templates/ — cPanel-provided templates.

If you do not specify a value, the system uses the path and template values to determine the template's source directory.

Note:

You must include either the source parameter or the path and template parameters.

Example: source=/usr/local/cpanel/3rdparty/share/site_templates/under_construction
template
string

The template's directory's name.

Note:

You must include either the source parameter or the path and template parameters.

Example: template=under_construction
Responses
200

HTTP Request was successful.

Response Schema: application/json
apiversion
integer

The version of the API.

func
string

The name of the method called.

module
string

The name of the module called.

object
get/SiteTemplates/publish
Request samples
uapi --output=jsonpretty \
  --user=username \
  SiteTemplates \
  publish \
  target  or  docroot='/home/example/public_html'
Response samples
application/json
{
  • "apiversion": 3,
  • "func": "publish",
  • "module": "SiteTemplates",
  • "result": {
    • "data": null,
    • "errors": null,
    • "messages": null,
    • "metadata": {
      • "transformed": 1
      },
    • "status": 1,
    • "warnings": null
    }
}