Connect. Communicate. Collaborate. Securely.

Home » Kerio User Forums » Kerio Connect » Kerio Connect - CardDav PHP access with kerio-api not working
  •  
loggiboogi

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

I just want to access my providers kerio connect server with the
KerioConnectApi.php class.

This code bellow is a tutorial from the kerio-api.zip, which i have downloaded

The version of the kerio-api is 1.4.0-234
The verion of the kerio connect server from my provider is 9.0.4

The access looks like this:

/**********
<?php

require_once(dirname(__FILE__) . '/src/KerioConnectApi.php');

/*
 * Set your Kerio Connect account
 */
/* Login credentials */
$hostname = 'myhoster.somewhere.net/carddav/';
$username = 'ME<_at_>MY-EMAIL-ADDRESS.COM';
$password = '**********';

$api = new KerioConnectApi('Sample application', 'Kerio Technologies', '1.0');

/* Main application */
try {

    /* Login */
    $session = $api->login($hostname, $username, $password);

    /*
     * You can continue writing code here
     * and add your custom code, e.g.
     * print fooBar();
     */

    /* Get who am I ? */
    $response = $api->sendRequest('Session.whoAmI');
    $fullname = $response['userDetails']['fullName'];

    printf('Success. You are logged in as <b>%s</b> using the Administration API.', $fullname);

} catch (KerioApiException $error) {

    /* Catch possible errors */
    print $error->getMessage();
}

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




The problem im facing is, that the rersponse is:
"Cannot connect to myhoster.somewhere.net/carddav/ using port 4040"

Has anybody an idea why i dont can connect?

  •  
Pavel Dobry (Kerio)

Messages: 5144
Karma: 241
Send a private message to this user
loggiboogi wrote on Fri, 02 September 2016 15:10

Has anybody an idea why i dont can connect?



I have one. I think you misunderstood Kerio API. It is API for administration, not for CardDAV.
For CardDAV client use standard HTTPS protocol on 443 or 8443 and your own CardDAV client, not API client.

Knowledge Base: http://kb.kerio.com/.
Technical support: http://www.kerio.com/support
------------------
Stay Connected Anytime, Anywhere. Discover Kerio Cloud!
  •  
loggiboogi

Messages: 2
Karma: 0
Send a private message to this user
Hmm okay, let's assume this api is only for administration purpose.

But there must be a way to access my Kerio Connect Account through PHP

This are the official paths to access CardDav:
kb.kerio.com/product/kerio-connect/email-clients/mobile-devi ces/manual-configuration-of-caldav-and-carddav-accounts-1327 .html

When I access the paths with this PHP script:
github.com/christian-putzke/CardDAV-PHP/blob/master/carddav. php

I get the following errors:
array(1) { [0]=> array(7) { ["response"]=> string(536) "/carddav/HTTP/1.1 403 Forbidden/carddav/calendar-proxy-write/HTTP/1.1 403 Forbidden/carddav/calendar-proxy-read/HTTP/1.1 403 Forbidden" ["http_code"]=> int(207) ["url"]=> string(29) "bmail3.sui-inter.net/carddav/" ["method"]=> string(8) "PROPFIND" ["content"]=> NULL ["content_type"]=> NULL ["header"]=> string(720) "HTTP/1.1 401 Unauthorized Connection: Close Content-Type: text/html Date: Thu, 22 Sep 2016 14:07:42 GMT Server: Kerio Connect 9.0.4 WWW-Authenticate: Basic realm="bmail3.sui-inter.net" X-UA-Compatible: IE=edge HTTP/1.1 207 Multi status Connection: Close Content-Type: text/xml; charset="utf-8" Date: Thu, 22 Sep 2016 14:07:42 GMT DAV: 1, access-control, calendar-access, calendar-schedule, calendar-proxy, calendar-availability, calendarserver-private-events, calendar-auto-schedule, calendarserver-principal-property-search, calendarserver-sharing, calendarserver-sharing-no-scheduling, addressbook, calendar-default-alarms Server: Kerio Connect 9.0.4 Transfer-Encoding: chunked X-UA-Compatible: IE=edge" } } 


Any idea whats wrong here?
When i google this issues, im not able to nailed it.
Can please somebody give me a hint?


  •  
Pavel Dobry (Kerio)

Messages: 5144
Karma: 241
Send a private message to this user
loggiboogi wrote on Thu, 22 September 2016 16:16

Any idea whats wrong here?
When i google this issues, im not able to nailed it.
Can please somebody give me a hint?


Yes, check the documentation for that PHP library. It requires you to use particular collection from CardDAV. Ie. https://example.com/addressbooks/users/{resource|principal|u sername}/{collection/ - Kerio Connect uses same URL schema as Apple servers). Example: HTTP(S)://mail.example.com/carddav/users/example.com/user-name

Therefore you cannot use /carddav/ URL unless you have full CardDAV client with ability to list servers resources and access .well-know URL.

Knowledge Base: http://kb.kerio.com/.
Technical support: http://www.kerio.com/support
------------------
Stay Connected Anytime, Anywhere. Discover Kerio Cloud!
Previous Topic: User unable to access address book
Next Topic: Kerio Connect windows version to ubuntu/VM version
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: Sun Dec 11 14:44:47 CET 2016

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