This function lists the cPanel account's domains.
Note:
For this function to succeed, the /var/cpanel/userdata/username/main file (where username represents the authenticated user) must possess the correct permissions. If a permissions error occurs, this function returns blank values for all of its returns and does not return an error message.
uapi --output=jsonpretty \ --user=username \ DomainInfo \ list_domains
{- "apiversion": 3,
- "func": "list_domains",
- "module": "DomainInfo",
- "result": {- "data": {- "addon_domains": [- "addondomain.com"
 ],
- "main_domain": "example.com",
- "parked_domains": [- "parkeddomain.com"
 ],
- "sub_domains": [- "subdomain.example.com"
 ],
- "is_temporary": {- "property1": 0,
- "property2": 0
 }
 },
- "errors": null,
- "messages": null,
- "metadata": { },
- "status": 1,
- "warnings": null
 }
}