API for accessing contacts

Asked by Jason Hanley on 2009-11-02

I'm starting to look at implementing contact synchronization between Ubuntu One and Android. The recent Android 2.0 release includes support for creating sync adapters for your own data sources. So I'm looking for the best way to access the contacts in Ubuntu One.

What API's are available to access the contacts? I've seen various bits about using Google protocol buffers. Is there any sort of REST API available?

Question information

English Edit question
Ubuntu One Servers Edit question
No assignee Edit question
Last query:
Last reply:
Elliot Murphy (statik) said : #1

Hi Jason,

The contacts system is logically separate from the file sharing system,
and the contacts records don't make use of google protocol buffers.

Contacts are stored in CouchDB in a (hopefully) somewhat standard
format, and other applications can easily read and edit those contacts.
The Ubuntu One desktopcouch system replicates the contents of that
contacts database with the cloud, and thats how you can see and edit
your contacts at https://one.ubuntu.com/contacts.

There are 3 places you can look at to see how to interact with the
contacts system:

- the evolution-couchdb package which shipped in Ubuntu 9.10 has the
code which supports the Ubuntu One address book in Evolution. Here you
can see how to read and write contacts using C and glib.
- the macaco contacts address book is a new project written by a
community member is a neat address book that uses the same data backend:
- finally, there is a simple python library that allows you to easily
read and write contacts records, shippped in the
python-desktopcouch-records package in Ubuntu 9.10. To see a primitive
demo application, run "python -m desktopcouch.records.contacts", and it
will show a list of names for the contacts you currently have in stored
in the contacts database.

Replication of the desktopcouch contacts database and other databases
such as bookmarks and tomboy notes is all handled by the desktopcouch
service, and you can see the replication log files by looking in

Now, that covers the desktop. If you want to write a sync adapter to run
on Android, you probably won't want to run a couchdb instance on the
phone. CouchDB uses OAuth and an HTTP interface to do the replication,
so it's definitely possible for you to use a raw REST interface to
couchdb.one.ubuntu.com in order to read your contacts database. Either
Chad Miller or Stuart Langridge can probably help you with details on
how to do the OAuth signing, and the details of the REST API that you
would use in order to discover the address of your contacts database on
the CouchDB cloud server.

We are planning to rollout an over-the-air contact syncing capability
that would use SyncML and your phones wifi or data connection, and this
would likely be available only to paying Ubuntu One subscribers. This
will be available to beta testers probably in a couple of months. An
Android application would be included in that solution.. I'm not at all
trying to dissuade you from working on your own solution for syncing
contacts to Android phones, I just want to be up front about what work
is already happening so you don't get caught by surprise later on.

Hope this helps, and feel free to stop by #ubuntuone on Freenode if you
want to discuss in more detail. We'll also be writing some documentation
for programmers that want to integrate their applications with the
contacts system, so hopefully it will be easier to discover the answers
soon :)
Elliot Murphy | https://launchpad.net/~statik/

Rodrigo Moya (rodrigo-moya) said : #2

Also, you have the format used for contacts defined at http://www.freedesktop.org/wiki/Specifications/desktopcouch/contact

Can you help with this problem?

Provide an answer of your own, or ask Jason Hanley for more information if necessary.

To post a message you must log in.