Revision as of 20:07, 25 November 2008 by Jason (talk | contribs)


Specify the request on the command line in an XPath-inspired syntax, and zmsoap takes care of authenticating, generating the envelope, sending the request, and writing the response to stdout.

(zmjava com.zimbra.common.soap.SoapCommandUtil got revamped as zmsoap in 5.0.7)


$ zmsoap --help
zmsoap [options] <path1> [<path2> ...]                                          
  --help (-h)                 Print usage information.                          
  --mailbox (-m) name         Mailbox account name.  mail and account requests  
                              are sent to this account.  Also used for          
                              authentication if -a and -z are not specified.    
  --target name               Target account name to which requests will be     
                              sent.  Only used for non-admin sessions.          
  --admin (-a) name           Admin account name to authenticaste as.           
  --zadmin (-z)               Authenticate with zimbra admin name/password from 
  --password (-p) pass        Password.                                         
  --passfile (-P) path        Read password from file.                          
  --element (-e) path         Root element path.  If specified, all path        
                              arguments that don't start with a slash (/) are   
                              relative to this element.                         
  --type (-t) type            SOAP request type (mail, account, admin).         
                              Default is admin.                                 
  --url (-u) http[s]://...    Server hostname and optional port.                
  --verbose (-v)              Print the SOAP request and other status           
  path [path ...]             Element or attribute path and value.  Roughly     
                              follows XPath syntax:                             



$ zmsoap -z -e GetAccountInfoRequest/account=user1 -v @by=name

Sending admin auth request to https://localhost:7071/service/admin/soap

<GetAccountInfoRequest xmlns="urn:zimbraAdmin">
  <account by="name">user1</account>

<GetAccountInfoResponse xmlns="urn:zimbraAdmin">
  <a n="zimbraId">decf3d72-623c-44d1-be34-23df4d285fb1</a>
  <a n="zimbraMailHost"></a>

$ zmsoap -m user1 -p test123 -u http://localhost:7070/service/soap --type account GetInfoRequest | head

<GetInfoResponse xmlns="urn:zimbraAccount">
  <version>unknown unknown unknown unknown</version>


$ zmsoap -z -m user1 SearchRequest/query=in:inbox | head

<SearchResponse xmlns="urn:zimbraMail" offset="0" more="1" sortBy="dateDesc">
  <c f="u" score="1.0" id="-514" n="1" sf="1211495060000" d="1211495060000">
    <su>Goodmail test</su>
    <fr>Tastes great!</fr>
    <e d="goodmailbot42" a="" t="f"></e>
    <m id="514"></m>
  <c n="1" score="1.0" d="1211495060000" id="-525" f="u" sf="1211495060000">
    <su>Welcome to the Zimbra Collaboration Suite source!</su>


$ zmsoap -z -m -v -e FolderActionRequest/action op=empty id=1 recursive=false

Sending admin auth request to https://localhost:7071/service/admin/soap

<FolderActionRequest xmlns="urn:zimbraMail">

<FolderActionResponse xmlns="urn:zimbraMail">
  <action op="empty" id="1"></action>

Connectivity To Another Server

This command sends a GetServerRequest to and filters enabled services with grep.

$ zmsoap -z -v -u -e GetServerRequest/ @by=name | grep zimbraServiceEnabled
    <a n="zimbraServiceEnabled">antivirus</a>
    <a n="zimbraServiceEnabled">antispam</a>
    <a n="zimbraServiceEnabled">logger</a>
    <a n="zimbraServiceEnabled">mailbox</a>
    <a n="zimbraServiceEnabled">mta</a>
    <a n="zimbraServiceEnabled">stats</a>
    <a n="zimbraServiceEnabled">snmp</a>
    <a n="zimbraServiceEnabled">ldap</a>
    <a n="zimbraServiceEnabled">spell</a>
    <a n="zimbraServiceEnabled">imapproxy</a>


zmmailbox is a much refined command & is the typical admin tool along with zmprov

Jump to: navigation, search