Page 1 of 2 12 LastLast
Results 1 to 10 of 14

Thread: Acces to quotas information through SOAP

  1. #1
    Join Date
    Oct 2008
    Location
    France
    Posts
    14
    Rep Power
    7

    Exclamation Acces to quotas information through SOAP

    hello,

    i'm in the way of creation a php interface to zimbra.
    I user this class:
    http://www.zimbra.com/forums/develop...-soap-api.html

    First i really don't know how to see the space that used for user, in the admin interface or with soap request...
    Second when i apply a quota of 150Mb of a user, when i get result in soap or ldap the result is zimbraMailQuota = 157286400 ...so 157MB do you know why ?

    thanks,
    Syruis.

  2. #2
    Join Date
    Oct 2008
    Location
    France
    Posts
    14
    Rep Power
    7

    Question

    For the problème with 150&157, i have see the problem it since the size of a space disk is 1Mo = 1024 o..

    But I don't know where i can see the size of a emailbox...

    Rgds,

  3. #3
    Join Date
    May 2006
    Location
    USA
    Posts
    6,242
    Rep Power
    21

    Default

    He does have it included in the php class - zimbraAdmin.php:
    Code:
    <GetQuotaUsageRequest xmlns="urn:zimbraAdmin"';
    if ($limit != 0)
      $soapmessage .= ' limit=\"$limit\"';
    if ($offset != 0)
      $soapmessage .= ' offset=\"$offset\"';
    if ($domain != "")
      $soapmessage .= ' domain=\"$domain\"';
    if ($sort != "")
      $soapmessage .= ' sortBy=\"$sort\"';
    if ($sortAsc != "")
      $soapmessage .= ' sortAscending=\"$sortAsc\"';
    $soapmessage .= '>
    </GetQuotaUsageRequest>
    soap-admin.txt
    Code:
    <GetQuotaUsageRequest [limit="..."] [offset="..."] [domain="{limit-to-domain}"]  
             [sortBy="{sort-by}"] [sortAscending="{sort-ascending}"]]> 
    </GetQuotaUsageRequest> 
     
    <GetQuotaUsageResponse more="{more-flag}" [searchTotal="{search-total}"]> 
      <account name="{name}" id="{id}" used="quota-used" limit="quota-limit"/>+ 
    </GetQuotaUsageResponse> 
     
    Notes: 
    GetQuotaUsageRequest 
      limit - the number of accounts to return (0 is default and means all) 
      offset - the starting offset (0, 25, etc) 
      domain - the domain name to limit the search to 
      sortBy - valid values: "percentUsed", "totalUsed", "quotaLimit" 
      sortAscending - whether to sort in ascending order (0/1), 0 is default, so highest quotas are returned first 
      more-flag = true if more accounts left to return 
      search-total = total number of accounts that matched search (not affected by limit/offset) 
      used = used quota in bytes, or 0 if no quota used 
      limit = quota limit in bytes, or 0 if unlimited 
     
    The target server should be specified in the soap header (see soap.txt, <targetServer>). 
     
    When sorting by "quotaLimit", 0 is treated as the highest value possible.
    Admin console:
    Server Statistics > Server > Mailbox Quota tab

    CLI:
    zmprov GetQuotaUsage localhost
    Spits it out in bytes- second column is max quota (0=unlimited) third column will be used amount

    Could do something like:
    zmprov gqu `zmhostname` | awk {'print " "$3" "$2" "$1'}

  4. #4
    Join Date
    Oct 2008
    Location
    France
    Posts
    14
    Rep Power
    7

    Exclamation

    Quote Originally Posted by mmorse View Post
    He does have it included in the php class - zimbraAdmin.php:
    Code:
    <GetQuotaUsageRequest xmlns="urn:zimbraAdmin"';
    if ($limit != 0)
      $soapmessage .= ' limit=\"$limit\"';
    if ($offset != 0)
      $soapmessage .= ' offset=\"$offset\"';
    if ($domain != "")
      $soapmessage .= ' domain=\"$domain\"';
    if ($sort != "")
      $soapmessage .= ' sortBy=\"$sort\"';
    if ($sortAsc != "")
      $soapmessage .= ' sortAscending=\"$sortAsc\"';
    $soapmessage .= '>
    </GetQuotaUsageRequest>
    soap-admin.txt
    Code:
    <GetQuotaUsageRequest [limit="..."] [offset="..."] [domain="{limit-to-domain}"]  
             [sortBy="{sort-by}"] [sortAscending="{sort-ascending}"]]> 
    </GetQuotaUsageRequest> 
     
    <GetQuotaUsageResponse more="{more-flag}" [searchTotal="{search-total}"]> 
      <account name="{name}" id="{id}" used="quota-used" limit="quota-limit"/>+ 
    </GetQuotaUsageResponse> 
     
    Notes: 
    GetQuotaUsageRequest 
      limit - the number of accounts to return (0 is default and means all) 
      offset - the starting offset (0, 25, etc) 
      domain - the domain name to limit the search to 
      sortBy - valid values: "percentUsed", "totalUsed", "quotaLimit" 
      sortAscending - whether to sort in ascending order (0/1), 0 is default, so highest quotas are returned first 
      more-flag = true if more accounts left to return 
      search-total = total number of accounts that matched search (not affected by limit/offset) 
      used = used quota in bytes, or 0 if no quota used 
      limit = quota limit in bytes, or 0 if unlimited 
     
    The target server should be specified in the soap header (see soap.txt, <targetServer>). 
     
    When sorting by "quotaLimit", 0 is treated as the highest value possible.
    Admin console:
    Server Statistics > Server > Mailbox Quota tab

    CLI:
    zmprov GetQuotaUsage localhost
    Spits it out in bytes- second column is max quota (0=unlimited) third column will be used amount

    Could do something like:
    zmprov gqu `zmhostname` | awk {'print " "$3" "$2" "$1'}
    I have see. But it's really doesn't work. the function "zimbra_get_cos" "zimbra_get_current_volumes" is bug too.

    I have modify many "function"... like "zimbra_search_gal" but for this one, i haven"t show where is the problem.

    Syruis.
    Last edited by Syruis; 11-03-2008 at 01:22 AM.

  5. #5
    Join Date
    Mar 2006
    Location
    Beaucaire, France
    Posts
    2,322
    Rep Power
    13

    Default

    I renamed the thread, in order to show the real problem (SOAP and quota).

  6. #6
    Join Date
    Oct 2008
    Location
    France
    Posts
    14
    Rep Power
    7

    Default

    Example1:
    "zimbra_get_cos" always return:
    3128soap:Senderno such cos: test@test.fraccount.NO_SUCH_COSbtpool0-9:1225702223229:a64b3cc9eef60d95

  7. #7
    Join Date
    Oct 2008
    Location
    France
    Posts
    14
    Rep Power
    7

    Default

    Quote Originally Posted by Klug View Post
    I renamed the thread, in order to show the real problem (SOAP and quota).
    Ok thanks...

  8. #8
    Join Date
    Oct 2008
    Location
    France
    Posts
    14
    Rep Power
    7

    Default

    Quote Originally Posted by Syruis View Post
    Example1:
    "zimbra_get_cos" always return:
    3128soap:Senderno such cos: test@test.fraccount.NO_SUCH_COSbtpool0-9:1225702223229:a64b3cc9eef60d95
    zimbra_get_quota_usage(0,0,"testdomain.com","","") ; =>

    soap:Senderparse error: Error on line 11 of document : Open quote is expected for attribute "domain" associated with an element type "GetQuotaUsageRequest". Nested exception: Open quote is expected for attribute "domain" associated with an element type "GetQuotaUsageRequest".service.PARSE_ERRORbtpo ol0-9:1225703586774:a64b3cc9eef60d9

    So i do:
    // if ($domain != "")
    // $soapmessage .= ' domain=\"'.$domain.'\"';

    And it return "3132" ... "3133" ... "3134" .. etc ( and it have no signification for me ) does anyone knows why?

    ..
    Excuse my poor English it's not my matern language...
    Last edited by Syruis; 11-03-2008 at 02:57 AM.

  9. #9
    Join Date
    Oct 2008
    Location
    France
    Posts
    14
    Rep Power
    7

    Exclamation

    Solution.. for get a quota for a mail Call:
    Code:
    $val=$zim->zimbra_get_quota_usage($limit = 0, $offset = 0,$domain, $sort = "", $sortAsc = "");//retourne tous les quota du domaine
    
    		if (!$val)//DEBUG
    			return array(0 => 'return false xml error');
    		
    		$taille = sizeof($val['ACCOUNT']);$i=0;
    		while($i != $taille){
    			if (trim($val['ACCOUNT'][$i]['NAME']) == trim($email))
    				return $val['ACCOUNT'][$i];
    				
    			$i++;
    			
    		}
    		return array(0 => 'return false no account for this email ('.$email.')');
    And modification in ZimbraAdmin.php
    Code:
    function zimbra_get_quota_usage($limit = 0, $offset = 0, $domain = "", $sort = "", $sortAsc = "") {
    
    		$xml = new xml2Array();
    		$this->set_zimbra_header();
    		$soapmessage = $this->soapheader . '
    		<GetQuotaUsageRequest xmlns="urn:zimbraAdmin"';
    		if ($limit != 0)
    			$soapmessage .= ' limit=\"'.$limit.'\"';
    		if ($offset != 0)
    			$soapmessage .= ' offset=\"$offset\"';
    //	if ($domain != "")
    			$soapmessage .= ' domain="'.$domain.'"';
    		if ($sort != "")
    			$soapmessage .= ' sortBy=\"$sort\"';
    		if ($sortAsc != "")
    			$soapmessage .= ' sortAscending=\"$sortAsc\"';
    		$soapmessage .= '>' .
    				'
    		</GetQuotaUsageRequest>
    		</soap:Body>
    		</soap:Envelope>';
    		curl_setopt($this->curlhandle, CURLOPT_POSTFIELDS, $soapmessage);
    		if (!($zimbraSOAPResponse = curl_exec($this->curlhandle))) {
    			$this->zimbraerrno = curl_errno($this->curlhandle);
    			$this->zimbraerror = curl_error($this->curlhandle);
    			return false;
    		}
    		$res = $xml->parse($zimbraSOAPResponse);
    		if (isset ($res['SOAP:ENVELOPE']['SOAP:BODY']['GETQUOTAUSAGERESPONSE']))
    			return $res['SOAP:ENVELOPE']['SOAP:BODY']['GETQUOTAUSAGERESPONSE'];
    		return false;
    	}
    Thanks for all,
    regards

  10. #10
    Join Date
    Oct 2009
    Posts
    10
    Rep Power
    6

    Default new xml2Array()

    can you post the code for this one

Similar Threads

  1. Replies: 8
    Last Post: 01-29-2010, 03:40 AM
  2. [SOLVED] upgrading to latest 4.5 release
    By ak2009 in forum Installation
    Replies: 6
    Last Post: 01-17-2009, 09:08 AM
  3. Zimbra OSS 4.5.11 Re-install
    By newmember in forum Installation
    Replies: 0
    Last Post: 09-09-2008, 11:26 PM
  4. 4.5.11 to 5.06 Migration Suggestion
    By newmember in forum Migration
    Replies: 15
    Last Post: 09-02-2008, 07:59 PM
  5. Replies: 8
    Last Post: 04-21-2007, 11:29 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •