Wrong client_id using API

Discussion in 'Developers' Forum' started by MatusSopko, Sep 22, 2022.

  1. MatusSopko

    MatusSopko New Member

    We have a strange issue with client_id used with API.
    For some domains (not all), the client_id is different from the [client_id] path in document_root.
    In the web_domain table for a specific domains, we have:
    sys_groupid = 1651, but the document_root is /var/www/clients/client1650/web1253
    For adding the client we use:
    $params = array(....);
    $client_id = $client->client_add($session_id, $reseller_id, $params);
    then we create a domain
    $params = array(...);
    $webdomain_id = $client->sites_web_domain_add($session_id, $client_id, $params, $readonly = false);
    after this, we create a database. The database is correct for all clients(client_id)
    $database_id = $client->sites_database_user_add($session_id, $client_id, $params);
     
  2. till

    till Super Moderator Staff Member ISPConfig Developer

    That#s perfectly fine as the sys_groupid is not the client_id, they are different and independent ID's. They might be the same by coincidence, but they do not have to be the same, so never mix up sys_groupid and client_id or try to use sys_groupid instead of a client_id.

    sys_groupid = primary ID of the table sys_group, this ID identifies a group in ISPConfig.
    client_id = primary ID of the table client, it identifies a client in ISPConfig.

    Clients are members of groups. You can look up the sys_groupid of a client in sys_group table and you can also look up the primary group ID of a client in the sys_group table (the table has columns for sys_groupid and client_id) and there are also lookup functions in the API for this.
     
  3. MatusSopko

    MatusSopko New Member

    I'm a little confused now. The API function
    $client->client_add($session_id, $reseller_id, $params);
    returns me cleint_id which I put into
    $client->sites_web_domain_add($session_id, $client_id, $params, $readonly = false);
    Then when I log-in to ISPConfig and check the client, I don't see his domain.
     
  4. till

    till Super Moderator Staff Member ISPConfig Developer

    Then there is probably something wrong with your script. The API works fine, many tools use it like the migration tool.
     

Share This Page