This function creates a subdomain.
Important:
When you disable the Web Server role, the system disables this function.
domain required | string The subdomain name to create. Example: domain=subdomain |
rootdomain required | string <domain> The domain on which to create the new subdomain. The domain must already exist on the cPanel account. Example: rootdomain=example.com |
canoff | integer Default: 1 Whether to use a canonical name (CNAME) in the Apache® configuration for self-referential URLs.
Example: canoff=1 |
dir | string <path> The subdomain's document This value defaults to the user's home directory Note: If the Restrict document roots to public_html value is set to Off in WHM's Tweak Settings interface (WHM >> Home >> Server Configuration >> Tweak Settings), this parameter defaults to the Example: dir=/public_html/directory_name |
disallowdot | integer Default: 0 Whether to remove the dot (
Example: disallowdot=1 |
uapi --output=jsonpretty \ --user=username \ SubDomain \ addsubdomain \ domain='subdomain' \ rootdomain='example.com'
{- "apiversion": 3,
- "func": "addsubdomain",
- "module": "SubDomain",
- "result": {
- "data": null,
- "errors": null,
- "messages": null,
- "metadata": { },
- "status": 1,
- "warnings": null
}
}