There are soap domains_domain_get and domains_domain_add but I'm missing update in interface/lib/classes/remote.d/domains.inc.php After importing a batch of maildomains I'd like to now split them to separate clients programatically. I started by adding to interface/lib/classes/remote.d/domains.inc.php: Code: //* Update a record public function domains_domain_update($session_id, $client_id, $params) { if(!$this->checkPerm($session_id, 'domains_domain_update')) { throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.'); return false; } return $this->updateQuery('../client/form/domain.tform.php', $client_id, $params); } And naming the function in interface/web/client/lib/remote.conf.php for 'Domaintool functions' On the client side I'm trying to lookup a domain ... It seems to need an ID, which I can query from the db. And then call update on the modified params array. But I end up with the 'SOAP Error: domain_error_empty' error. Any quick thoughts about what I'm missing? Code: $domain = $client->domains_domain_get($session_id, $domain_id); $params = array( // 'domain' => $domain_name, // 'client_id' => 42, // 'sys_groupid' => 2, // 'sys_userid' => 2, 'auth_preset' => array('userid' => 2, 'groupid' => 2), ) + $domain; $reseller_id = 1; try { $isp_client_id = $client->domains_domain_update($session_id, $reseller_id, $params); }
Looks ok to me so far, are you really sure that domain is passed in the $params array when you call it?
client_idI got rid of the first error, but it's not saving the domain with a new client. It seems that I was missing a parameter... I've now updated the function signature to ($session_id, $client_id, $primary_id, $params) I've been digging around, amongst others in _getSQL() and see that only the 'domain' field is added to the query ... which I don't think I would ever want to update. So I'm a bit confused as to how the web UI does change the client for a client domain. I've pushed a branch to https://git.ispconfig.org/helmo/ispconfig3/commits/domains_domain_update Commit 35b30e33d3f9dcc1fa9d47093dd2784f0fdf88f8 looked promising but that line still evaluates false since $_SESSION["s"]["user"]["client_id"] is 0 in my API request.