Zimbra REST API: Address Book Methods | Zimbra

Document
Alert! This article is written for Zimbra OSE users. As of December 2023, Synacor will no longer be providing support for Zimbra OSE. You might want to consider trying out Carbonio Community Edition – Zextras’s free and open-source email and collaboration platform.

For additional guidance, check out our community articles detailing the process of migrating from your current platform to Carbonio CE.

With this article we took a general overview of Zimbra REST API and its different methods for retrieving data. In this article, however, we’re going to discover together the methods concerning the address book.

Get Contacts

This method Gets the contacts in the selected folder, so the HTTP method to read data is get. Clearly the default folder is “contacts”, but you can choose custom ones by the user.

The basic URL structure is the following one:

http(s)://<host>/home/sample.user/contacts?{params}

Formats

This method supports the following formats:

csv, json, xml, tgz, zip

Please note that if you select “ZIP” format, the contacts will be included as individual vCard .vcf files

Parameters

There are different parameters you can add in your “url” to get contacts, but none of them is mandatory:

  • fmt – format is optional. The default one is csv.
  • csvfmt – if you choose csv format, leaving it by default or by selecting it, you can choose between different types of CSV, like zimbra-csv, yahoo-csv, thunderbird-csv and outlook-csv
  • meta – this is also optional. You can choose between meta=1 to include meta files, and meta=0 to not include them. By default it is set to meta=1.
  • query – you can optionally add a query string.

Examples

Here we want to show you some examples on this method’s usage.

To download the contacts as a CSV file, as we saw above, we have two options, the first using the basic command without parameters, and the second one where we specify the format parameter:

https://mail.sampledomain.com/home/james.red/contacts

https://mail.sampledomain.com/home/james.red/contacts?fmt=csv

If you want, for example, to retrieve the contacts with the string “employee” in JSON format from companycontacts folder, you can write as follows:

https://mail.sampledomain.com/home/james.red/companycontacts?fmt=json&query=employee

Import Contacts

To Import contacts we are going to use the HTTP post method. Again the default folder is “contacts”, but you can choose custom ones by the user.

The basic URL is:

http(s)://<host>/home/sample.user/contacts?{params}

Formats

In this case we can choos between two formats, csv and vcf

Parameters

In this case the fmt parameter is mandatory. The default one remains csv.

  • fmt. Required. The import format. Defaults to csv.

For both methods Autentication is Required.

Download Zextras Suite for Zimbra OSE

Post your comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Zimbra REST API: Mailbox Methods | Zimbra
Zimbra REST API: Calendar Methods | Zimbra