All URIs are relative to https://cpanel-server.tld:2083/execute
| Method | HTTP request | Description |
|---|---|---|
| list_site_templates | GET /SiteTemplates/list_site_templates | Return available Site Publisher templates |
| list_user_settings | GET /SiteTemplates/list_user_settings | Return Site Publisher websites' information |
| publish | GET /SiteTemplates/publish | Add Site Publisher website |
InlineResponse200469 list_site_templates()
Return available Site Publisher templates
This function lists available templates for cPanel's Site Publisher feature.
- If you call this function as the
rootorsystemuser, the function lists therootuser's templates. - If you call this function as a reseller, the function lists the
rootuser's templates and the reseller's templates. - If you call this function as a cPanel user, the function's output depends on the account's owner:
- If the
rootuser owns the account, the function only lists therootuser's templates. - If a reseller owns the account, the function lists the
rootuser's templates and that reseller's templates.
- If the
Note:
The template directory's location depends on whether the root user or a reseller owns the template:
/var/cpanel/customizations/site_templates/— Therootuser's templates./home/username/var/cpanel/reseller/site_templates/— A reseller's templates, whereusernamerepresents 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.
- Basic Authentication (BasicAuth):
import clientapi_cpanel
from clientapi_cpanel.models.inline_response200469 import InlineResponse200469
from clientapi_cpanel.rest import ApiException
from pprint import pprint
# Defining the host is optional and defaults to https://cpanel-server.tld:2083/execute
# See configuration.py for a list of all supported configuration parameters.
configuration = clientapi_cpanel.Configuration(
host = "https://cpanel-server.tld:2083/execute"
)
# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.
# Configure HTTP basic authorization: BasicAuth
configuration = clientapi_cpanel.Configuration(
username = os.environ["USERNAME"],
password = os.environ["PASSWORD"]
)
# Enter a context with an instance of the API client
with clientapi_cpanel.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = clientapi_cpanel.SitePublisherManagementApi(api_client)
try:
# Return available Site Publisher templates
api_response = api_instance.list_site_templates()
print("The response of SitePublisherManagementApi->list_site_templates:\n")
pprint(api_response)
except Exception as e:
print("Exception when calling SitePublisherManagementApi->list_site_templates: %s\n" % e)This endpoint does not need any parameter.
- Content-Type: Not defined
- Accept: application/json
| Status code | Description | Response headers |
|---|---|---|
| 200 | HTTP Request was successful. | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]
InlineResponse200470 list_user_settings()
Return Site Publisher websites' information
This function lists information for the cPanel account's Site Publisher websites.
Note:
To retrieve the list of Site Publisher website information, the function queries the configurations.json file in each domain's document root. For more information, read our Guide to Site Publisher Templates documentation.
Important:
When you disable the Web Server role, the system disables this function.
- Basic Authentication (BasicAuth):
import clientapi_cpanel
from clientapi_cpanel.models.inline_response200470 import InlineResponse200470
from clientapi_cpanel.rest import ApiException
from pprint import pprint
# Defining the host is optional and defaults to https://cpanel-server.tld:2083/execute
# See configuration.py for a list of all supported configuration parameters.
configuration = clientapi_cpanel.Configuration(
host = "https://cpanel-server.tld:2083/execute"
)
# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.
# Configure HTTP basic authorization: BasicAuth
configuration = clientapi_cpanel.Configuration(
username = os.environ["USERNAME"],
password = os.environ["PASSWORD"]
)
# Enter a context with an instance of the API client
with clientapi_cpanel.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = clientapi_cpanel.SitePublisherManagementApi(api_client)
try:
# Return Site Publisher websites' information
api_response = api_instance.list_user_settings()
print("The response of SitePublisherManagementApi->list_user_settings:\n")
pprint(api_response)
except Exception as e:
print("Exception when calling SitePublisherManagementApi->list_user_settings: %s\n" % e)This endpoint does not need any parameter.
- Content-Type: Not defined
- Accept: application/json
| Status code | Description | Response headers |
|---|---|---|
| 200 | HTTP Request was successful. | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]
InlineResponse200471 publish(target__or__docroot, parameter_name=parameter_name, path=path, source=source, template=template)
Add Site Publisher website
This function publishes a Site Publisher website.
- This function uses the
/scripts/process_site_templatescript to publish the Site Publisher website. - This function creates the
configurations.jsonfile in the specified directory.- This file contains the user-entered data for the Site Publisher website and uses
0700permissions. - For more information, read our Guide to Site Publisher Templates documentation.
- This file contains the user-entered data for the Site Publisher website and uses
- 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_logfile. - The template directory's location depends on whether the
rootuser or a reseller owns the template:/var/cpanel/customizations/site_templates/— Therootuser's templates./home/username/var/cpanel/reseller/site_templates/— A reseller's templates, whereusernamerepresents 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.
- Basic Authentication (BasicAuth):
import clientapi_cpanel
from clientapi_cpanel.models.inline_response200471 import InlineResponse200471
from clientapi_cpanel.rest import ApiException
from pprint import pprint
# Defining the host is optional and defaults to https://cpanel-server.tld:2083/execute
# See configuration.py for a list of all supported configuration parameters.
configuration = clientapi_cpanel.Configuration(
host = "https://cpanel-server.tld:2083/execute"
)
# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.
# Configure HTTP basic authorization: BasicAuth
configuration = clientapi_cpanel.Configuration(
username = os.environ["USERNAME"],
password = os.environ["PASSWORD"]
)
# Enter a context with an instance of the API client
with clientapi_cpanel.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = clientapi_cpanel.SitePublisherManagementApi(api_client)
target__or__docroot = '/home/example/public_html' # str | The directory that will contain the Site Publisher website.
parameter_name = 'My Website' # str | 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](https://go.cpanel.net/guide-to-site-publisher-templates-template-files) documentation for more information. If you use a third-party template, consult that template's documentation or its `meta.json` file. (optional)
path = '/usr/local/cpanel/3rdparty/share/site_templates/' # str | 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. (optional)
source = '/usr/local/cpanel/3rdparty/share/site_templates/under_construction' # str | 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. (optional)
template = 'under_construction' # str | The template's directory's name. **Note:** You **must** include either the `source` parameter **or** the `path` and `template` parameters. (optional)
try:
# Add Site Publisher website
api_response = api_instance.publish(target__or__docroot, parameter_name=parameter_name, path=path, source=source, template=template)
print("The response of SitePublisherManagementApi->publish:\n")
pprint(api_response)
except Exception as e:
print("Exception when calling SitePublisherManagementApi->publish: %s\n" % e)| Name | Type | Description | Notes |
|---|---|---|---|
| target__or__docroot | str | The directory that will contain the Site Publisher website. | |
| parameter_name | str | 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. | [optional] |
| path | str | 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. | [optional] |
| source | str | 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. | [optional] |
| template | str | The template's directory's name. Note: You must include either the `source` parameter or the `path` and `template` parameters. | [optional] |
- Content-Type: Not defined
- Accept: application/json
| Status code | Description | Response headers |
|---|---|---|
| 200 | HTTP Request was successful. | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]