API primary_id

Discussion in 'Developers' Forum' started by jnsc, Nov 23, 2014.

  1. jnsc

    jnsc rotaredoM Moderator

    Hi,

    In the API, for example in the sites_web_domain_get() fonction, the parameters are $session_id and $primary_id.

    The $session_id param is clear, but what does the $primary_id relate to? is it the domain_id from table web_domain, or is it something more complicated?

    Thanks for your reply.
     
  2. till

    till Super Moderator Staff Member ISPConfig Developer

    The primary ID is the primary ID (auto increment) field of the table, in case of the websites, it is the domain_id. But you can also pass a array to all _get functions as primary ID, an arry switsches the function to search mode. e.g.

    array('domain' => 'yourdomain.tld')

    to get the website for yourdmain.tld
     
  3. jnsc

    jnsc rotaredoM Moderator

    Thanks Till,

    I looked to easy for me, it's certenaly because I'm used to ISPConfig 2 :)

    Regards
    Jonas
     
  4. jnsc

    jnsc rotaredoM Moderator

    I still have a question.

    Some function have a get_all variant, some other have not. I achieved to do the same by using

    PHP:
    $domains $client->sites_web_domain_get($session_id, array('domain' => '%'));
    Is it ok to use this functions in this ways (%)? Or should I create new get_all functions?

    Thanks
    Jonas
     
  5. till

    till Super Moderator Staff Member ISPConfig Developer

    Thats ok. the get_all functions are old, they existed befotĀ“re the search functionw as implemented and they will get marked as deprecetd in one of the next versions to clean up the api, so better use the _get functions.
     
  6. jnsc

    jnsc rotaredoM Moderator

    Ok, good to know this.

    Thanks for your reply.
     

Share This Page