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.
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:
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
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=1to include meta files, and
meta=0to not include them. By default it is set to
query– you can optionally add a query string.
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:
If you want, for example, to retrieve the contacts with the string “employee” in JSON format from companycontacts folder, you can write as follows:
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:
In this case we can choos between two formats, csv and vcf
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.