Connect. Communicate. Collaborate. Securely.

Home » Developer Zone » API/SDK Writers » Connect: Create User via API
  •  
aw-consultancy

Messages: 2
Karma: 0
Send a private message to this user
Hi,

I want to add some users via API.

I can create the user and add his group but I want to update his contact-information, too:
first- and lastname, ...
company location

This is, what works:
<?php
require_once('/opt/kerio-api-php/src/KerioConnectApi.php');

$domain = 'domain.tld';
$group = "GROUP-NAME";
$newuser = 'testuser01';
$newpass = 'testuser01';
$newfull = "User, Test";

$api = new KerioConnectApi('Sample application', 'Kerio Technologies s.r.o.', '1.4.0.234');

try {
        $session = $api->login($hostname, $username, $password);
        $params = array("query" => array("fields" => array("id","name")));
        $result = $api->sendRequest('Domains.get', $params);
        foreach ($result['list'] as $r) {
                if($r['name'] == $domain) {
                        $domainId       = $r['id'];
                        $domainName     = $r['name'];
                }
        }

        $params = array("query" => array("fields" => array("id","name")), 'domainId' => $domainId);
        $result = $api->sendRequest('Groups.get', $params);
        foreach ($result['list'] as $r) {
                if($r['name'] == $group) {
                        $groupId       = $r['id'];
                        $groupName     = $r['name'];
                        $groupList[]   = $r;
                }
        }

        if($newuser and $newpass and $domainId) {
                $params = array(
                        'users' => array(array(
                                'loginName' => $newuser,
                                'password' => $newpass,
                                'domainId' => $domainId,
                                'fullName' => $newfull,
                                'userGroups' => $groupList,
                                'isEnabled' => TRUE
                        ))
                );
                $api->sendRequest('Users.create', $params);
        }
        
} catch (KerioApiException $error) {
        print $error->getMessage();
}

if (isset($session)) {
        $api->logout();
}

?>


But I found nothing, how to edit/create stuff in the contact-tab:
./fa/4771/0/

Regards awc

  •  
Kerio/GFI Brian

Messages: 852
Karma: 90
Send a private message to this user
You can perform the action in the administration and inspect the communication to capture the format of the request. Have a look at this help topic http://manuals.gfi.com/en/kerio/connect/content/api/inspecti ng-kerio-api-communication-in-a-web-browser-1989.html

Brian Carmichael
Instructional Content Architect
  •  
aw-consultancy

Messages: 2
Karma: 0
Send a private message to this user
Thank you - I will try that.
Previous Topic: EWS: All day event support
Next Topic: CALDAV VEVENT filter help
Goto Forum:
  


Disclaimer:
Kerio discussion forums are intended for open communication between forum members and may contain information and material posted by members which may be useful in learning about Kerio products. The discussion forums are not intended to provide technical support for any specific product. Any information implied or expressed in the discussion forums is that of the posting member. Kerio is in no way responsible for the information posted in the forums, or its accuracy. Kerio employees may participate in the discussions, but their postings do not represent an offical position of the company on any issues raised or discussed. Kerio reserves the right to monitor and maintain the forums to promote free and accurate exchange of information.

Current Time: Sat Sep 22 07:19:06 CEST 2018

Total time taken to generate the page: 0.73036 seconds
.:: Contact :: Home ::.
Powered by: FUDforum 3.0.4.