Results 1 to 2 of 2

Thread: Cannot Import ics Calendar via REST

  1. #1
    amartin is offline Intermediate Member
    Join Date
    Dec 2010
    Posts
    24
    Rep Power
    4

    Default Cannot Import ics Calendar via REST

    I am attempting to import each user's calendar (ics format) into Zimbra using REST. I need to be able to import each user's calendar as the Zimbra admin user since I do not know each user's password. I have authorized the admin user to have read/write access to each user's account:
    Code:
    zmmailbox -z -m user1 mfg /Calendar account admin@zimbra.mydomain.com rw
    I then try to import the calendar via REST, but I receive an "ics formatter failure" error:
    Code:
    curl -v -u admin@zimbra.mydomain.com:mypassword --upload-file user1.ics http://zimbra.mydomain.com/service/home/user1/calendar?fmt=ics
    Error:
    Code:
    * About to connect() to zimbra port 80 (#0)
    *   Trying xxx.xxx.xxx.xxx... connected
    * Connected to zimbra (xxx.xxx.xxx.xxx) port 80 (#0)
    * Server auth using Basic with user 'admin@zimbra.mydomain.com'
    > PUT /service/home/user1/calendar?fmt=ics HTTP/1.1
    > Authorization: Basic xxxxxxxxxxx
    > User-Agent: curl/7.19.7 (x86_64-pc-linux-gnu) libcurl/7.19.7 OpenSSL/0.9.8k zlib/1.2.3.3 libidn/1.15
    > Host: zimbra
    > Accept: */*
    > Content-Length: 2241
    > Expect: 100-continue
    > 
    < HTTP/1.1 100 Continue
    < HTTP/1.1 500 system failure: ics formatter failure
    < Date: Tue, 28 Dec 2010 15:32:51 GMT
    < Content-Length: 0
    < 
    * Connection #0 to host zimbra left intact
    * Closing connection #0
    However, if I run the exact same command only changing the calendar to the admin's calendar (changed part in bold below), the same ics file imports just fine:
    Code:
    curl -v -u admin@zimbra.mydomain.com:mypassword --upload-file user1.ics http://zimbra/service/home/admin/calendar?fmt=ics
    * About to connect() to zimbra port 80 (#0)
    *   Trying xxx.xxx.xxx.xxx... connected
    * Connected to zimbra (xxx.xxx.xxx.xxx) port 80 (#0)
    * Server auth using Basic with user 'admin@zimbra.mydomain.com'
    > PUT /service/home/admin/calendar?fmt=ics HTTP/1.1
    > Authorization: Basic xxxxxxxxxxxxxxxxxxxxxxxxxxxxx
    > User-Agent: curl/7.19.7 (x86_64-pc-linux-gnu) libcurl/7.19.7 OpenSSL/0.9.8k zlib/1.2.3.3 libidn/1.15
    > Host: zimbra
    > Accept: */*
    > Content-Length: 2241
    > Expect: 100-continue
    > 
    < HTTP/1.1 100 Continue
    < HTTP/1.1 200 OK
    < Date: Tue, 28 Dec 2010 15:08:08 GMT
    < Content-Length: 0
    < 
    * Connection #0 to host zimbra left intact
    * Closing connection #0
    Because of this I know that my ics file is valid (I also ran it through the iCalendar Validator) and this appears to be a problem with Zimbra. It seems that the admin user should be able to post this calendar to the user's account since I gave it read/write access. Any ideas on why this is not working or another way to go about importing these calendars?

    Thanks!

  2. #2
    rpbarbati is offline Starter Member
    Join Date
    Mar 2014
    Posts
    2
    Rep Power
    1

    Thumbs up You want to use a pre-auth token with a SOAP call to populate...

    We are populating zimbra calendars using SOAP and pre-authorization.

    The admin pre-auth call gets you an authtoken which you then use in the populate calendar call. The pre-auth SOAP call looks like this...

    <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:zimbraAdmin">

    <soap:Header>
    <context xmlns="urn:zimbra"/>
    </soap:Header>
    <soap:Body>
    <AuthRequest xmlns="urn:zimbraAdmin">
    <name><[adminAuthName]></name>
    <password><[adminAuthPassword]></password>
    </AuthRequest>
    </soap:Body>
    </soap:Envelope>


    And the populate call looks like this...

    <soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    xmlns:soap="http://www.w3.org/2003/05/soap-envelope">
    <soap:Header>
    <context xmlns="urn:zimbra">
    <authToken><[AuthToken]></authToken>
    <account by="name"><[AccountName]></account>
    <sessionId id=""></sessionId>
    </context>
    </soap:Header>
    <soap:Body>
    <ImportAppointmentsRequest ct="ics" l="<[parentFolderId]>" xmlns="urn:zimbraMail">
    <content><[ICSFile]></content>
    </ImportAppointmentsRequest>
    </soap:Body>
    </soap:Envelope>

    In both of the above, observe that there are markers for where you will need to insert variable values - the markers begin and end with <[ and >]. The AuthToken in the second call is found in the response of the first call. It can be used for multiple calls to the same account, but does expire eventually.
    Embedf your ICS file contents where shown and you should be fine. Ensure the ICS has no tabs or blank lines in it - i.e. each line should begin in column 0. Ensure your dates follow the format YYYYMMDDTHHMMSS. You may also want to specify TRANSP:TRANSPARENT on your imported events.

    The REST calls work when using the zimbra account name and password using HTTP Basic Authentication. I have not been able to successfully use the pre-auth setup with REST calls. Not saying it doesn't work, just saying that it isn't documented anywhere formally (which to me is the equivalent of not working).

    Good luck and post your results either way

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. import Sun Calendar into ics error
    By morgan in forum Migration
    Replies: 6
    Last Post: 04-10-2009, 06:10 PM
  2. REST ICS Import
    By fultonj in forum Migration
    Replies: 3
    Last Post: 04-09-2008, 07:16 AM
  3. ical4j.data.ParserException
    By amit_saini54 in forum Migration
    Replies: 0
    Last Post: 12-06-2007, 07:45 AM
  4. Issues with Outlook Calendar Migration - ics
    By soxfan in forum Migration
    Replies: 2
    Last Post: 02-28-2007, 06:50 PM
  5. Please Skip Calendar in Import Wizard
    By ThorGoLucky in forum Migration
    Replies: 3
    Last Post: 02-15-2007, 08:51 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
  •