CardDAV Interface Documentation

As of version 3.0 the iAddressBook comes with a CardDAV interface that allows you to use the iAddressBook as your personal iCloud alternative. Just hook up your iPhone, Android phone or OSX Addressbook to your installation and the contacts will sync automatically between all the connected clients. Including Photo sync of course. The iAddressbook uses SabreDAV (http://sabre.io) as the backend interface. Authentication and CardDAV support must be turned on. The client can then use the same user credentials used for login as defined in conf/auth.php. You can test the settings by going to your iAddressbook installation and adding /carddav.php to the URL as follows:

http://yourdomain.com/your_address_book/carddav.php

The demo installation also has CardDAV enabled so you can try this yourself right now: http://demo.iaddressbook.org/carddav.php

  • Enable CardDAV support (HINT: $conf['carddav_enable'] = 1;)
  • Enable and setup user authentication (HINT: $conf['auth_enabled'] = 1;)

Apache Users:

  • :!: Make sure PHP is running as Apache module (and not as FastCGI application). Otherwise HTTP Basic Auth will not work and the carddav interface cannot authenticate you
  • (optional) Copy htaccess.example to .htaccess and adjust RewriteBase to match your URI (i.e. if your URL is http://mydomain.com/something/iaddressbook set RewriteBase to /something/iaddressbook)
The settings in .htaccess enable CardDAV clients to determine the correct URI for your account automatically. If the settings are not present you might have to specify your URL as
http://myserver.com/iaddressbook/carddav.php or even
http://myserver.com/iaddressbook/carddav.php/principals/your_username/.

Clients will ask you to provide the URL to your CardDAV server. The exact syntax depends on the abilities of the client. If you have activated the .htaccess file that comes with the installation you should be able to use a very simple form (i.e. such as myserver.com/iaddressbook). Sometimes the simple format will not work and you have to be more specific. In order to get the right settings the following examples should guide you in finding the correct format. Try them one by one to see which one is required.

Before you start ensure you can login using your web browser (visit: http://myserver.com/iaddressbook/carddav.php)

  1. Try: myserver.com/iaddressbook
  2. Try: myserver.com/iaddressbook/carddav.php
  3. Try: https://myserver.com/iaddressbook (Make sure that you use http or https depending on your SSL support)

(Instructions for OSX Mavericks 10.9)

  1. Open OSX Addressbook
  2. Open the settings dialog
  3. Select tab Accounts
  4. Click the (+) symbol to add a new account
  5. Choose “Other contacts account…” and click Continue
  6. Type in your User Name and Password and Server Address
  7. Click Create

The settings for other OSX versions might change slightly. OSX can deal with the simple form (given you have activated the shipped .htaccess file).

Apple seems to have introduced buggy code in OSX Mavericks 10.9 (up to 10.9.5) that suffers from race conditions. Some of the contact photos are correct, others show up on the wrong contact yet others are distorted. If you remove the account and re-add it the situation “shuffles” and other contact photos are wrong. I never got all the contacts to be correct again. The only workaround I found is to extract all cards from the website using vCard extract, then importing them directly to the OSX Addressbook. It will complain that you have duplicates but you can select “update all” and dismiss the message.

short: it works but the client requires you to use https://myserver.com/iaddressbook/carddav.php/principals/<username>/

  1. instructions follow
  1. Open the Settings App
  2. Scroll down to “Mail, Contacts, Calendars” and open it
  3. In the ACCOUNTS section click “Add Account”
  4. Select “Other”
  5. In the “CONTACTS” section click “Add CardDAV Account”
  6. Specify Server, User Name and Password and optionally change the description
  7. Tap Next
  1. Go to the Play Store and buy/install CardDAV-Sync
  2. Check if you have to install this "Workaround App" (required for Samsung devices to prevent removal of your account after phone restarts)
  3. Once installed open the Settings Dialog
  4. In Section ACCOUNTS select “Add Account”
  5. Choose “CardDAV”
  6. When asked what kind of CardDAV (i.e. Google, Yahoo etc.) select the first option “CardDAV”
  7. Enter Server name, Username and Password then tap Next
  8. Set the Account Name to something more descriptive than “default” and tap Finish
  9. Close the “Congratulations” dialog by tapping Done
Contact photos from the iAddressbook are synced to the phone correctly. But for some unknown reason, contact photos set on the device are not synced back.