updating via REST (and a REST update)

By | May 8, 2006

Time for another REST update. We’ll talk about updating content via REST urls, as well as a new formater.


We’ve added the ability to update/create content by POST’ing content to REST urls. GETs continue to remain read only, with no side-effects (as they should be).

For example, you can POST an RFC822 formatted message to your inbox REST url to append messages to the inbox folder. Using the popular curl program, this would look like the following:

curl -u schemers:password 
--data-binary @/tmp/rfc822.txt 

https://server/service/home/schemers/inbox

Note, you currently have to use /service/home for POSTs instead of /zimbra/home, because /zimbra/home issues a redirect, which isn’t kosher with POSTs. We’ll be fixing that in an upcoming release.

Other items that can be updated this way are calendar appointments (ICS), and contacts (csv and the new vcf (vCard) format):

curl -u schemers:password 
--data-binary @/tmp/new.csv 

https://server/service/home/schemers/contacts?fmt=csv

curl -u schemers:password 
--data-binary @/tmp/new.ics 

https://server/service/home/schemers/calendar?fmt=ics

New vCard formatter

As I mentioned above, we also have a new formatter. The “vcf” formatter can export your contacts as series of vcards (vCard 3.0), or can be used to export a single contact as a vCard (to be used by the web client in a future version).

To get all your contacts as a series of vCard entries, specify “vcf” as the formatter on the GET url:

  http://server/zimbra/home/schemers/contacts.vcf  

You can also import one or more vCards by POST’ing to a specific contacts folder (support for multiple contact folders in the web client is coming!), using fmt=vcf:

curl -u schemers:password 
--data-binary @/tmp/new.vcf 

https://server/service/home/schemers/contacts?fmt=vcf

Until next time…

We still need to do a better job of exposing the REST functionality (making it easy to import/export all types of data) in the web client, and will hopefully address that in an upcoming release.


Comments are closed.