HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials

HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials (http://www.howtoforge.com/forums/index.php)
-   Developers' Forum (http://www.howtoforge.com/forums/forumdisplay.php?f=33)
-   -   Getting all Clients via API (http://www.howtoforge.com/forums/showthread.php?t=57677)

teves 20th June 2012 11:06

Getting all Clients via API
 
Hello,

can someone please tell me if there is a way to retrieve all clients at once via the API?

Thank you!

regards, Tom

till 20th June 2012 22:05

This should work:


$clients = $client->client_get($session_id, array('parent_client_id' => '0'));

teves 21st June 2012 11:12

hi Till,

this works perfectly, thank you very much!
I looked it up in the API documentation contained in the ISPConfig release package, but could not find a hint. Did I miss it or is it not in there? Is there another place where I can find out the details of the API without bugging you all the time? ;-)

Regards, Tom

till 21st June 2012 11:24

Hi,

all ..._get() functions in the API support a array as ID parameter and in the array you can use any field of the corresponding database table. The values can contain % as wildcard.

so this query:

$clients = $client->client_get($session_id, array('contact_name' => '%John%'));

woud return all clients were "John" is in the contact name field.

teves 21st June 2012 13:21

Hi,

thanks! This is a very helpful piece of information!

Most recently I have programmed for Plesk, and I have to point out that their RPC API ist a large pile of crap (and their support is even worse). I have not seen a lot of the ISPConfig API yet, but I like it much better already.... ;-)

And, btw, I have seen a lot of the ISPConfig community support, and I cannot stress enough how great it is!


Regards, Tom

teves 26th June 2012 13:18

I am sorry but I have another question...

I would like to create a list of domains of a certain client (via API), but the domain array I get via SOAP does not seem to contain information on the owner client.
When I fetch all domains and try to find out the clients via the client_get_id function, I only get the admin ID (which is the user who created the domains).

The api function domains_get_all_by_user gives a list of the domains created by a certain user, I assume? But this does not help me here...

But in Ispconfig, Tab "Sites", there is a list of the domains, with the owner clients in front. So there must be a way...

Can someone give me a hint please?

Regards, Tom

till 26th June 2012 13:55

Quote:

I would like to create a list of domains of a certain client (via API), but the domain array I get via SOAP does not seem to contain information on the owner client.
The records conatin the user and group information. Every client has its own group, so you can select them by filtering on the group ID which is associated with the client.

teves 3rd July 2012 10:53

When I try to fetch the subdomains of a domain with the following SOAP request:
sites_web_subdomain_get($session_id, array("parent_domain_id" => $id) )
I do not only get the subdomains, but also the aliasdomains with the same parent_domain_id. Is this bug or feature?

I tested it with the request
sites_web_aliasdomain_get($session_id, array("parent_domain_id" => $id))
too, the behaviour is exactly the same....

So the output of two different SOAP commands is the same, this can't be intentional, can it?

till 3rd July 2012 11:16

Both commands work on the same table and with array("parent_domain_id" => $id) you override all other selections. If you want to use the array paremeter and get subdomains only, then the query is:

sites_web_subdomain_get($session_id, array("parent_domain_id" => $id,"type" => 'subdomain') )

teves 3rd July 2012 15:06

Quote:

Originally Posted by till (Post 281186)
The records conatin the user and group information. Every client has its own group, so you can select them by filtering on the group ID which is associated with the client.

It should be mentioned that it is necessary to use the undocumented (!) SOAP call
client_get_groupid($session_id, $client_id)
to obtain the group_id of a client. Strangely, the group_id is not included in the answers to the client_get() and client_get_by_username() functions.


All times are GMT +2. The time now is 19:10.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.