Zimbra REST API: Mail Methods

In this article we have seen how Zimbra uses the REST API and what are the different methods for retrieving data.
In this guide, we are going to analyze the two methods related to mail.

Get Folder

This method is used to get the items in the folder, so it uses the HTTP get method to read items.

The basic URL structure is the following one:

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

Folder

We need to specify the name of the mail folder we want to access. And that’s the {folder} object we entered in the url above. It can be both a default one or a custom one created by user. As for the default ones we have:

  • inbox
  • drafts
  • sent
  • trash
  • junk

Formats

As we’ve seen in this article, we have various formats to choose from. In this method, in particular, we have: xml, json, rss, zip, tar, tgz.

Please note that if you are going to use archive formats (zip,tar,tgz), then maill messages will be packed in the archive as .eml files

Parameters

There are two parameters in this method. The response format “fmt”, which is mandatory, and the query string which is optional.

Examples

Below we want to show you a couple of pratical examples on how to use this method.

To retrieve sent folder in RSS format:

https://mail.sampledomain.com/home/james.red/sent?=rss

Below is an example where we want to retrieve the hardware folder (custom folder) and query for the sentence “new laptop” in XML format:

https://mail.sampledomain.com/home/james.red/hardware?fmt=xml&query=subject:"new+laptop"

Import Message

This method imports a message to a mail folder in MIME RFC822 format using HTTP post method.

The URL structure is the following one:

http(s)://<host>/home/sample.user/{folder}

Folder

As for the get folder, we need to specify the name of the mail folder we want to access. And that’s the {folder} object we entered in the url above. It can be both a default one or a custom one created by user. As for the default ones we have:

  • inbox
  • drafts
  • sent
  • trash
  • junk

In both methods Autentication is Required.

Post your comment

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

Zimbra REST API: Briefcase Methods
What is Zimbra