DNS
Domain Management
Create subdomain
This function creates a subdomain.
get/create_subdomain
Query parameters
document_rootstring required
Example:public_html/directory_name
The subdomain's document root within the home directory.
Note:
- An invalid document root path will cause this function to fail.
- If the Restrict document roots to public_html value is set to On in WHM's Tweak Settings interface (WHM >> Home >> Server Configuration >> Tweak Settings), this parameter must begin with the public_html/ path. For more information, read the cpanel.config file documentation.
domainstring domain required
Example:subdomain.example.com
The subdomain name to create.
use_canonical_name0 | 1
Whether to use a canonical name in the Apache® configuration for self-referential URLs.
- 1 — Use the canonical name.
- 0 — Do not use the canonical name.
Response
HTTP Request was successful.
Example response
{
"data": {
"username": "example"
},
"metadata": {
"command": "create_subdomain",
"reason": "OK",
"result": 1,
"version": 1
}
}