Recently I was in the situation where I needed to manage users in Kolab from PHP.

There is an API for the Kolab Webadmin, and it is documented here:

There is also a PHP class, that I could have used: But for some reason, I am using CURL.

It took me some time to figure out how to do the GET or POST calls for connecting to the API and call, user.delete, user.add and users.list.

Therefore, I have created a small PHP class, that shows how to do that.

You can find it here:

There is also a test.config.php and a test.php to show the usage of that class.

During development, I sometimes got the message: “Internal error”. This is from the class kolab_api_controller, eg.

Actually, it would help if that error was logged to /var/log/kolab-webadmin/errors with some detail:

else {
    Log::error("API controller: Internal Error, ".$service . "_" . $method. " Post: " .print_r($postdata,true). " Get: ".print_r($_GET,true));
    $this->output->error("Internal error", 500);
Accessing the Kolab Webadmin API from PHP via CURL
Tagged on: