Results 1 to 3 of 3

Thread: Zimbra SOAP API request appointments for a calendar including repeat time interval

  1. #1
    Join Date
    Jun 2013
    Posts
    4
    Rep Power
    2

    Default Zimbra SOAP API request appointments for a calendar including repeat time interval

    I have Googled extensively and tried mining the Zimbra webmail front end for requests and responses to the Zimbra SOAP API but I can't find how to do the following:
    - request all appointments for a calendar using XML (the request below is in JSON and returns XML, would be nice to be able to make the request in XML)
    - for repeating appointments, obtain the repeating time interval

    Below is an example of how it is done with JSON request (except that the JSON response does not appear to include the repeating time interval for repeating appointments).
    The request below requests all appointments (between 1/1/1970 and 1/1/2114 = Unix dates 0 to 4544208000000 in MSEC) for the Calendar with ID=10.
    The response (in XML) has 2 appointments, the first is a single appointment, the second is a daily repeating appointment but none of the properties seem to indicate the repeating time interval.

    Request URL: http://www.MyZimbraServer.com/service/soap/BatchRequest

    Request:

    { "Body" : { "BatchRequest" : { "SearchRequest" : { "_jsns" : "urn:zimbraMail",
    "calExpandInstEnd" : 4544208000000,
    "calExpandInstStart" : 0,
    "limit" : "500",
    "locale" : { "_content" : "en_AU" },
    "offset" : 0,
    "query" : { "_content" : "inid:10" },
    "sortBy" : "none",
    "types" : "appointment"
    },
    "_jsns" : "urn:zimbra",
    "onerror" : "continue"
    } },
    "Header" : { "context" : { "_jsns" : "urn:zimbra",
    "account" : { "_content" : "ASample@account.com",
    "by" : "name"
    },
    "authToken" : "A_valid_authToken_goes_here",
    "format" : { "type" : "xml" },
    "sessionId" : { "_content" : 14630204,
    "id" : 14630204
    },
    "userAgent" : { "name" : "ZimbraWebClient",
    "version" : "5.0"
    }
    } }
    }

    Response (content of <BatchResponse> only shown):

    <BatchResponse xmlns="urn:zimbra">
    <SearchResponse xmlns="urn:zimbraMail" more="0" sortBy="none" offset="0">
    <appt alarm="1" loc="In the office" transp="O" fb="B" id="327" rev="804" isOrg="1" fba="B" score="1.0" t="" compNum="0" name="Subject for a single appointment" s="0" d="1375942257000" ms="900" md="1376003780" class="PUB" uid="e21505b9-c64a-42e0-abe6-07010f44f458" ptst="AC" status="CONF" cm="1" l="10" dur="3600000" sf="" f="" x_uid="e21505b9-c64a-42e0-abe6-07010f44f458" invId="327-326">
    <or d="Joe Bloggs" a="ASample@account.com" url="ASample@account.com" />
    <fr>These are notes for my single appointment</fr>
    </appt>
    <appt alarm="1" loc="On the beach" transp="O" fb="B" recur="1" id="338" rev="811" isOrg="1" fba="B" score="1.0" t="" compNum="0" name="Subject for a daily repeating appointment" s="0" d="1375944660000" ms="1004" md="1376011270" class="PUB" uid="921dc981-c9a6-4f11-9617-ccad3328c144" ptst="AC" cm="1" status="CONF" l="10" dur="3600000" sf="" f="" x_uid="921dc981-c9a6-4f11-9617-ccad3328c144" invId="338-337">
    <or d="Joe Bloggs" a="ASample@account.com" url="ASample@account.com" />
    <fr>These are notes for my repeating appointment</fr>
    </appt>
    </SearchResponse>
    </BatchResponse>

  2. #2
    Join Date
    Jun 2013
    Posts
    4
    Rep Power
    2

    Default

    The answer to the sub-question above (how to make the JSON request as an XML SOAP call) is shown here. This gives the same response as shown above.

    <soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope">
    <soap:Header>
    <context xmlns="urn:zimbra">
    <userAgent name="ZimbraWebClient" version="1.0" />
    <account by="name">ASample@account.com</account>
    <format type="xml" />
    <authToken>A_valid_authToken_goes_here</authToken>
    </context>
    </soap:Header>
    <soap:Body>
    <BatchRequest xmlns="urn:zimbra" onerror="stop">
    <SearchRequest xmlns="urn:zimbraMail" types="appointment" calExpandInstStar="0" calExpandInstEnd="4544208000000">
    <query>inid:10</query>
    </SearchRequest>
    </BatchRequest>
    </soap:Body>
    </soap:Envelope>

    However, the main question, remains - how does one obtain information defining the recurrence of a recurring appointment?

    The soap-calendar.txt document of the Zimbra documentation defines the following...

    //////////////////////////////////////////////////////////////////////
    //
    // GetRecur
    //
    // Retrieve the recurrence definition of an appointment
    //
    <GetRecurRequest id="calendar item id"/>

    <GetRecurResponse>
    [same as ExpandRecurRequest content]
    </GetRecurResponse>


    However I could not get the above to work, I tried the following...

    <BatchRequest xmlns="urn:zimbra" onerror="stop">
    <GetRecurRequest xmlns="urn:zimbraMail" id="921dc981-c9a6-4f11-9617-ccad3328c144"/>
    </BatchRequest>

    ...where the id used is the uid of the repeating appointment in the response above. However, this returns an INVALID_REQUEST SOAP fault. Is the namespace wrong within the GetRecurRequest tag above or is something else incorrect?

  3. #3
    Join Date
    Mar 2006
    Location
    Greenwood, IN
    Posts
    90
    Rep Power
    9

    Default

    Hi Simon,

    Have a look at Zimbra SOAP API Reference 8.0.4_GA_5737 and test with zmsoap. Use the id attribute from SearchResponse in your request as it correlates to mail_item.id database field.

    Code:
    zmsoap -v -z -m user@domain.tld GetRecurRequest @id=2263992
    <GetRecurRequest id="2263992" xmlns="urn:zimbraMail"/>
    <GetRecurResponse xmlns="urn:zimbraMail">
      <tz id="America/Chicago" stdoff="-360" stdname="CST" dayoff="-300" dayname="CDT">
        <standard wkday="1" min="0" sec="0" mon="11" hour="2" week="1"/>
        <daylight wkday="1" min="0" sec="0" mon="3" hour="2" week="2"/>
      </tz>
      <comp>
        <s u="1375117200000" d="20130729T120000" tz="America/Chicago"/>
        <e u="1375120800000" d="20130729T130000" tz="America/Chicago"/>
        <recur>
          <add>
            <rule freq="WEE">
              <interval ival="1"/>
              <byday>
                <wkday day="MO"/>
              </byday>
            </rule>
          </add>
        </recur>
      </comp>
      <cancel>
        <exceptId d="20130902T120000" tz="America/Chicago"/>
      </cancel>
    </GetRecurResponse>
    --
    Jason Bryan
    Zimbra R&D

Similar Threads

  1. Load all appointments including all attendees for user
    By Nicole Plattner in forum Developers
    Replies: 0
    Last Post: 06-10-2013, 09:08 AM
  2. Calendar appointments change time by one hour
    By Laird in forum Administrators
    Replies: 6
    Last Post: 10-28-2011, 01:38 AM
  3. Calendar appointments change time by one hour after DST
    By nglacet in forum Administrators
    Replies: 0
    Last Post: 10-07-2011, 10:24 AM
  4. Replies: 0
    Last Post: 02-07-2011, 05:40 PM
  5. Repeat calendar appointments failing.
    By dhallweb in forum Administrators
    Replies: 2
    Last Post: 04-12-2006, 12:33 PM

Tags for this Thread

Posting Permissions

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