Remote api missing function to domains_domain_update

Discussion in 'Developers' Forum' started by helmo, Nov 20, 2018.

  1. helmo

    helmo New Member HowtoForge Supporter

    There are soap domains_domain_get and domains_domain_add but I'm missing update in interface/lib/classes/remote.d/
    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/
      //* 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?

      $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);
  2. till

    till Super Moderator Staff Member ISPConfig Developer

    Looks ok to me so far, are you really sure that domain is passed in the $params array when you call it?
  3. helmo

    helmo New Member HowtoForge Supporter

    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

    Commit 35b30e33d3f9dcc1fa9d47093dd2784f0fdf88f8 looked promising but that line still evaluates false since $_SESSION["s"]["user"]["client_id"] is 0 in my API request.
    Last edited: Nov 27, 2018
  4. helmo

    helmo New Member HowtoForge Supporter

Share This Page