[Owncloud] Is exporting of addressbooks possible - maybe using cron?

Thomas Tanghus thomas at tanghus.net
Mon Dec 30 17:36:29 UTC 2013


On Monday 30 December 2013 17:23 Mark Ziegler wrote:
> Am 08.03.13 14:41, schrieb Thomas Tanghus:
> > On Friday 08 March 2013 10:19 Chris Green wrote:
> >> I want to be able to copy addressbooks in and out of owncloud
> >> automatically.  I have owncloud running on my own server at home so I
> >> have direct access to it.
> >> 
> >> What would be useful would be a way to export the addressbook at
> >> intervals.  Could this be done using cron?  I can't find any
> >> documentation on the owncloud cron.
> >> 
> >> I guess I could simply DIY it by reading the database directly, that's
> >> not so difficult but I was just wondering if someone had done it
> >> already.
> > 
> > In the Contacts UI settings you get the CardDAV URL, something like
> > http://localhost/owncloud/remote.php/carddav/addressbooks/chris/contacts
> > 
> > Append '?export' to the end of that URL and enter your credentials.
> > 
> > Test with wget or curl. I use wget for my backups:
> > 
> > wget --auth-no-challenge --http-user=chris --http-password=xxxxxxxx -O \
> > 
> >      backup.vcf
> >      http://localhost/owncloud/remote.php/carddav/addressbooks/chris/cont
> >      acts?export
> Hello Thomas,
> 
> grabbed that old mail out of my archives.
> Just updated to v6 and had to adapt my backup cron jobs.
> For v6 I had to modify wget call and now it looks like:
> wget --auth-no-challenge --http-user=me --http-password=secret -O \
> backup.vcf
> http://localhost/index.php/apps/contacts/addressbook/local/1/export
> 
> Using this line gets me a nice vcf file of my default addressbook.

The other format 
http://localhost/owncloud/remote.php/carddav/addressbooks/[user]/[addressbook]?export 
should still work though, but from oC6 using it's own - undocumented - API is 
probably better.

> How to get all addressbooks at once?

I'm afraid not.

> Is there a way or do I have to get ids of each addressbook and make a
> call for each one?

You can call http://localhost/index.php/apps/contacts/addressbooks/ and parse 
the resulting JSON. It's a very simple format.

-- 
Med venlig hilsen / Best Regards

Thomas Tanghus



More information about the Owncloud mailing list