Zimbra offers Open Source email server software and shared calendar for Linux and the Mac
Go Back   Zimbra :: Forums > Zimbra Collaboration Suite > Developers

Welcome to the Zimbra :: Forums!
Welcome, if you would like to post a comment please register. We also encourage you to explore all things Zimbra with our team and members of the community.

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 03-07-2007, 06:56 AM
Active Member
 
Posts: 30
Default postinig to calendar with curl fails

Hey folks,
I'm working on some very very very preliminary integration with Stikkit.
I'm no programmer but I can hack my way around a shell script...
Stikkit's API allows me to pull my calendar items in .ics format, which I've done using curl. I was hoping to then use curl again to post those items into zimbra.

I did some searching for the command and found:
Code:
 curl -u user--data-binary ~/stikkits.ics http://server/zimbra/home/user/calendar?fmt=ics
However, it seems to fail on the first line of my stikkits.ics file (posed below)

I've also tried just using the built in sync feature to point a new calendar to Stikkit's feed (which I believe is an atom by default). Thats not an idea solution, but it was a way to troubleshoot. I didn't get any errors, but I didn't get any appointments either.

My goal is to eventually write a zimlet that lets me do some 2 way syncing b/t the two, but right now I have to do it with baby steps...

here is the result of my stikkit API call that returns a .ics file

Code:
BEGIN:VCALENDAR
VERSION:2.0
METHOD:PUBLISH
PRODID:-//Values of n//NONSGML Stikkit//EN
BEGIN:VEVENT
DTSTART;TZID=America/New_York:20070828T000000
BEGIN:VALARM
ACTION:DISPLAY
TRIGGER:20070827T234500
DESCRIPTION:Lunar eclipse\n\nOn august 28\nRemind me\nTag as photography
REPEAT:4
END:VALARM
SUMMARY:Lunar eclipse
DESCRIPTION:Lunar eclipse\n\nOn august 28\nRemind me\nTag as photography
CATEGORIES:photography
URL:http://www.stikkit.com/stikkits/318677
CLASS:PRIVATE
CREATED:20070306T123639
LAST-MODIFIED:20070306T123639
SEQ:1
UID:http://www.stikkit.com/stikkits/318677
END:VEVENT
Like I said, I'm no programmer, but if I need to modify a tag or field I think I can manage that....

thanks in advance!
Reply With Quote
  #2 (permalink)  
Old 03-07-2007, 08:38 AM
Zimbra Employee
 
Posts: 1,434
Default More detail...

Quote:
Originally Posted by SpaceBass View Post
Code:
 curl -u user--data-binary ~/stikkits.ics http://server/zimbra/home/user/calendar?fmt=ics
Just to make sure, you actually have spaces between the user and the --data-binary, right?

If so, what error is being returned?
__________________
Bugzilla - Wiki - Downloads - Before posting... Search!
Reply With Quote
  #3 (permalink)  
Old 03-07-2007, 09:04 AM
Active Member
 
Posts: 30
Default

Good catch, yes I do have spaces there...when I replaced my actual username with the word 'user' I must have lost the space...


Code:
<html><head><title>Apache Tomcat/5.5.15 - Error report</title><style><!--H1 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:22px;} H2 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:16px;} H3 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:14px;} BODY {font-family:Tahoma,Arial,sans-serif;color:black;background-color:white;} B {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;} P {font-family:Tahoma,Arial,sans-serif;background:white;color:black;font-size:12px;}A {color : black;}A.name {color : black;}HR {color : #525D76;}--></style> </head><body><h1>HTTP Status 500 - </h1><HR size="1" noshade="noshade"><p><b>type</b> Exception report</p><p><b>message</b> <u></u></p><p><b>description</b> <u>The server encountered an internal error () that prevented it from fulfilling this request.</u></p><p><b>exception</b> <pre>javax.servlet.ServletException: parse error: Caught ParseException parsing calendar: net.fortuna.ical4j.data.ParserException: Expected [BEGIN], read [/Users/ndawson/nickstikkits.ics] at line 1
/Users/ndawson/nickstikkits.ics
        com.zimbra.cs.service.UserServlet.doPost(UserServlet.java:445)
        javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
        com.zimbra.cs.servlet.ZimbraServlet.service(ZimbraServlet.java:162)
        javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
        com.zimbra.webClient.filters.SetHeaderFilter.doFilter(SetHeaderFilter.java:286)
</pre></p><p><b>root cause</b> <pre>com.zimbra.common.service.ServiceException: parse error: Caught ParseException parsing calendar: net.fortuna.ical4j.data.ParserException: Expected [BEGIN], read [/Users/ndawson/nickstikkits.ics] at line 1
/Users/ndawson/nickstikkits.ics
        com.zimbra.common.service.ServiceException.PARSE_ERROR(ServiceException.java:193)
        com.zimbra.cs.mailbox.calendar.ZCalendar$ZCalendarBuilder.build(ZCalendar.java:914)
        com.zimbra.cs.service.formatter.IcsFormatter.saveCallback(IcsFormatter.java:127)
        com.zimbra.cs.service.formatter.Formatter$SaveOperation.callback(Formatter.java:273)
        com.zimbra.cs.operation.Operation.schedule(Operation.java:190)
        com.zimbra.cs.service.formatter.Formatter.save(Formatter.java:103)
        com.zimbra.cs.service.UserServlet.doPost(UserServlet.java:438)
        javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
        com.zimbra.cs.servlet.ZimbraServlet.service(ZimbraServlet.java:162)
        javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
        com.zimbra.webClient.filters.SetHeaderFilter.doFilter(SetHeaderFilter.java:286)
</pre></p><p><b>note</b> <u>The full stack trace of the root cause is available in the Apache Tomcat/5.5.15 logs.</u></p><HR size="1" noshade="noshade"><h3>Apache Tomcat/5.5.15</h3></body></html>
Reply With Quote
  #4 (permalink)  
Old 03-07-2007, 09:28 AM
Zimbra Employee
 
Posts: 1,434
Default Bugzilla!

Looks like a syntax error parsing your .ics file. I'm not an .ics wizard, so why not just file this in bugzilla and attach your .ics file as an attachment to the new bug? We'll let you know if the .ics file is completely malformed or if there's a parser bug on our side...
__________________
Bugzilla - Wiki - Downloads - Before posting... Search!
Reply With Quote
  #5 (permalink)  
Old 03-07-2007, 10:48 AM
Active Member
 
Posts: 30
Default

Quote:
Originally Posted by dkarp View Post
Looks like a syntax error parsing your .ics file. I'm not an .ics wizard, so why not just file this in bugzilla and attach your .ics file as an attachment to the new bug? We'll let you know if the .ics file is completely malformed or if there's a parser bug on our side...
I'm happy to do that. I'm no stranger to software development in my profession but I am when it comes to open source and community efforts like this. I wasn't sure if 'just anyone' could log issues in bugzilla and what kinds of things constitute valid issues.

I'll log it today, thanks.
Reply With Quote
  #6 (permalink)  
Old 03-07-2007, 10:58 AM
Zimbra Employee
 
Posts: 228
Default

Note that use you can also use zmprov/zmmailbox to post to a rest url:

Code:
zmprov sm user1 pru /calendar test.ics
The sm (selectMailbox) command in zmprov will select a mailbox and switch you into zmmailbox command mode.

The pru (postRestUrl) command (part of zmmailbox) will post a file to a particular URL that is relative to the account.

I posted the sample you provided (after adding a END:VCALENDAR), and the server log (/opt/zimbra/log/mailbox.log) has:

Code:
com.zimbra.common.service.ServiceException: invalid request: Could not parse DURATION string: 20070827T234500
Your sample had that value in TRIGGER:
Code:
TRIGGER:20070827T234500
In taking a quick look at the iCalendar RFC, TRIGGER is supposed to be a duration relative to the appointment start time. If you want it to be a specific time, you need to use a different format:

Code:
     TRIGGER;VALUE=DATE-TIME:19970317T133000Z
I'm no iCalendar expert though, I just did a quick search through the RFC (and I'm in the middle of implementing calendar for the basic html client).
__________________
Bugzilla - Wiki - Downloads - Before posting... Search!
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes


Similar Threads

Why Join?

Registering let's you ask questions, makes it easier to search, displays any files attached to posts, and notifies you about replies.

blog.zimbra.com




 

SEO by vBSEO ©2011, Crawlability, Inc.