How to add subdomain to account under a reseller through API2
Hello all.
I have a master reseller account under which customer accounts are registered. I would like to add addon domains to these customer accounts using a cpanel instance authenticated with the master reseller account.
This is trivially done using the web interface. However, when I try to do it using the cpanel sdk/api2, I can only add the addon domain to the reseller account itself, not its sub-accounts.
I'm using PHP. Here's the relevant code-snippet adding the addon domain. I understand that the api call used doesn't have the "user" parameter which I was lead to believe it had, and that this is the reason the domain is added to the reseller:
So, the question is, how can I have this effect the sub-account (here contained in $usr) instead of the reseller accounts? I have searched wide and far already, but I have yet to find something that actually solves the problem. Any help or tips will be greatly appreciated. Thank you! Regards, devel
...
$cpCfg = array(
'cpanel'=>array(
'service'=>array(
'cpanel' => array(
'host' => $ip,
'user' => $rusr,
'password' => $rpw,
)
)
)
);
$cp = Cpanel_PublicAPI::getInstance($cpCfg);
$queryMF = array(
'module' => 'AddonDomain',
'function' => 'addaddondomain',
);
$queryArgs = array(
'user' => $usr,
'dir' => $domain,
'newdomain' => $domain,
'subdomain' => $domain
);
$response = $cp->cpanel_api2_request('cpanel', $queryMF, $queryArgs);
...
So, the question is, how can I have this effect the sub-account (here contained in $usr) instead of the reseller accounts? I have searched wide and far already, but I have yet to find something that actually solves the problem. Any help or tips will be greatly appreciated. Thank you! Regards, devel
-
Are you using the user's name, or the resellers name, when performing the login? 0 -
Hi Kenneth. Thanks for your reply. I'm using the reseller's username and password when logging in. The problem is that I don't have the passwords of the accounts under the reseller at hand--otherwise I would have used those directly. 0 -
Bumping this thread after almost two weeks. Hope that's not disallowed. Unfortunately I still haven't been able to find a working solution. Any help will be appreciated, thanks! 0 -
Have you tried the API call using the user's username and the reseller password? 0 -
Hi cPAndrewHodge. Thank you for the tip, it worked!. I would never have attempted that on my own, and I am very surprised that it is implemented like so. I would mark the thread title with [SOLVED], but it seems I cannot change it myself. 0
Please sign in to leave a comment.
Comments
5 comments