Part 1 of this project was to get downloads in the iCal format working so that people with desktop calendars can add events to them. Next up we want to be able to import into web calendars.
Since we’re talking about web calendars the sequence of events is a little different to with desktop calendars. Rather than having a link return a server-generated file that’s picked up by the desktop calendar, we simply point a link directly at the web calendar in question, and when the user clicks on it the data held in querystring parameters on that link is transmitted to the calendar. Sadly different calendars implement this differently, so you need to write custom formatting code for each calendar that you want to support. For that reason I’m going to stick to the biggest three, Yahoo, MSN, and Google (a possible motivation for big fish not to implement a standard URL format).
Please note that some of the following information is the product of my tinkering and may become unreliable as the companies that run these calendars make changes (if it isn’t unreliable already).
Google Calendar
Google’s instructions for publishing events are already about as simple as they can get, but I’ll summarise the basics here for the sake of completeness.
The components of my URL are:
| http://www.google.com/calendar/event? | - The location of this API |
| action=TEMPLATE | - Don’t edit this unless you know more than me (not hard). I haven’t found any other interesting values. |
| text=My Event | Put the title of your event in here |
| dates=20080101/20080101 | The start and end dates for your event (YYYYMMDD). If you want to specify an exact time instead of just the date then use YYYYMMDDTHHmmSS, e.g. 20080101T143000 would be half past two on the 1st Jan 2008. If you specify times don’t forget to convert them to PST (GMT -8 hours). |
| sprop=website:www.justgiving.com &sprop=name:Justgiving | The documentation says this is to identify the website or event source. It says it’s required, but excluding it seems to make no difference. |
| details=Don’t forget to donate at http://www.justgiving.com/richtest001 | This is the description of your event. Don’t forget to URL Encode. Using Carriage Return and Line Feed characters seems to work fine. These encode to %0D and %0A respectively so %0D%0A will create a new line when decoded at Google’s end. |
Insert test event into your Google calendar.
Google Calendar doesn’t return you to the original site when it finishes adding the event, so you may want to think about opening this link in a new window, either with window.open(), or preferably an HTML link using the target attribute.
There doesn’t appear to be any provision for adding reminders or recurring events using this URL format.
Yahoo Calendar
While looking for reference material for Yahoo’s calendar I came across a similar article to my own that covers the same ground. Is it a coincidence that the only similar article I’ve found is from someone else in the UK?
Anyway, the components of the URL for inserting an event into a user’s Yahoo calendar are these:
| http://calendar.yahoo.com/? | - The location of this API |
| v=60 | Seems to be required. Other values I’ve tried just failed rather than doing anything interesting |
| DUR=0100 | This is the duration of the event, in HHmm format. If you’re adding an all-day event then don’t bother with this. |
| TITLE=My Event | Put the title of your event in here |
| ST=20070201 | Start date/time, use either YYYYMMDD or YYYYMMDDTHHmmSS depending on whether it’s an all-day event |
| in_loc=My House | Location of the event |
| DESC | Description of the event |
| URL | Page to link back to from the calendar |
Insert test event into your Yahoo calendar.
UPDATE: Ryan McNallie has more information on his blog.
MSN Calendar
This was the most baffling API so far due to a complete absence of documentation, and one that’s not really to my taste since the software choice (ISAPI.dll) is visible in the URL. Not very elegant. On the other hand MSN calendar is the only one I’ve found that implements ID-based de-duplication. Anyway, here’s a working URL structure.
| http://calendar.msn.com/calendar/isapi.dll? | - The location of this API |
| pid=5020 | - This value seems to be required. Changing it caused an error for me. |
| pn=Site Name | - This is the name of your site. |
| id=Your Event ID | - Required. This is a unique ID to avoid duplication of the same event in the calendar. |
| n=0 | - This doesn’t seem to be required and I haven’t figured out what it is yet. Remove it at your own risk. |
| rurl=[encoded URL] | - Required. This is the URL to return the user to once you’ve finished adding this event to their calendar. Frustratingly it’s required, so you’ll need to handle MSN users differently to everyone else. |
| s=Event Subject | - The name of your event |
| d=20080113T040000Z/PT2H00M | - The date and time details of your event, in the format [start date]T[start time]/[duration]. I’d guess the timezone would be controlled by the Z or PT elements of the format but it seemed to ignore any changes I made so I’m going to leave that for now. |
| l=[encoded URL] | - The URL of the event on your website. |
| c=0 | - No idea. Not required |
| r=E15 | - Not sure. Not required |
| m=[Event Description] | - This is the URL Encoded body text for your event |
Add test event to MSN calendar
[UPDATE - 5th January 2010 - Windows Live Calendar]
MSN Calendar is long dead but redirects to Windows Live Calendar, so I thought I’d update this post with information on that.
You can find more thorough documentation on this Scribd document by Siva Vasanth, but the URL you want to construct is detailed below.
| http://calendar.live.com/calendar/calendar.aspx? | - The location of this API call |
| rru=addevent | - Don’t edit this unless you know more than me (not hard). |
| summary=My Event | Put the title of your event in here. Don’t forget to URL Encode. |
| location=London | Location description. Don’t forget to URL Encode. |
| dtstart | The start and end dates for your event YYYYMMDDTHHmmSS, e.g. 20080101T143000 would be half past two on the 1st Jan 2008. You may need to convert them to the right time zone for your calendar, I haven’t tested this. You may also be able to specify all-day events using the YYYYMMDD format. |
| dtend | Specify the end time of the event, format as above. |
| description=Don’t forget to buy a card | This is the description of your event. Don’t forget to URL Encode. |
I haven’t found any mention of specifying reminders, repetition, or anything other than basic event details.
Scrybe
Scrybe is still in closed beta, a year after launch. I can’t really justify spending time on it right now. If I can find the time once they’re live I might update this article.
Wednesday 9th January, 2008 at 02:34 |
[...] a few minutes to post new images. Luckily, Rich has lead by example and posted something new to his equally delinquent blog, hence inspiring [...]
Thursday 10th January, 2008 at 02:37 |
[...] Z or PT elements of the format but it seemed to ignore any changes I made so Im… source: Adding Events to Users Calendars – Part 2 – Web Calendars, Rich Marr’s Justgiving Tech [...]
Wednesday 30th January, 2008 at 22:55 |
thanks – was just what i was looking for. the google documentation was easy to find but all others, not so…
Friday 25th April, 2008 at 16:06 |
thanks Rich … good job … both google and yahoo test link is working, but msn is not working. Is there something missing? Please help. Thanks
Saturday 26th April, 2008 at 08:22 |
Sorry about that glieu there was a character missing from the return URL for some reason. It’s working now.
Friday 20th June, 2008 at 08:17 |
The only complete article I found so far… great job!!!
Would be really cool to have something like a common API that automatically generate the correct link, maybe grabbing the event date, place etc. from an xml or something…
any idea ?
Wednesday 19th November, 2008 at 22:01 |
Thanks for the posting,Very helpfull
Is there a way to delete these calendars. I can Add and modify the calendar, How do I delete the calendar entry.
Thursday 20th November, 2008 at 09:45 |
Sorry prem, I don’t remember coming across a technique to delete data using a URL. It’s possible there is one for each calendars, but I didn’t find it. Just out of curiousity, what’s the use case for that? Are you building a calendar synchronisation tool?
Friday 21st November, 2008 at 00:50 |
Yaa , its kind of calendar sync based on service procurements , When a procurement is cancelled , I would like to remove the calendar entry .
Also on the other hand I have noticed that the above URL in case of microsoft does not work with msn live calendar which is in Beta (http://calendar.live.com)
Friday 21st November, 2008 at 01:14 |
IF you want to add the calendars programatically to yahoo , there is an opensource by funambol , Bu this requires the yahoo username and password as input , works greate u can add , update and delete the calendars.
Its basically xml over http , service itself is not published by yahoo , Atleast i dint find it any where on web, Not sure of legal implications .also it does’nt work with BBAuth of yahoo .
http://sourceforge.net/project/showfiles.php?group_id=193700&package_id=236015&release_id=531426
Friday 21st November, 2008 at 09:47 |
Interesting. Good luck getting it working. Yeah, I suspected these notes wouldn’t stay up to date very long. If I get time to look into it I’ll write an update.
Tuesday 27th January, 2009 at 19:06 |
The MSN directions don’t work and one of the links goes off to a non-existent dyndns.org site. Well, the directions _initially_ look like they will work (I get the title of the event and the service asks, “Do you want to add this event to your calendar?”) but once you go to submit the actual event to your calendar, you end up on an error page. It was worth a shot since Yahoo and Google Calendars work fine. Since no one actually uses MSN Calendar, this isn’t really a deal-breaker for me. Just would have been nice.
Tuesday 27th January, 2009 at 22:43 |
Thanks for the update.
Friday 24th April, 2009 at 17:32 |
Is there a way to set a reminder for a Yahoo event?
Saturday 25th April, 2009 at 09:14 |
Hi David, sorry I don’t know if that’s possible. The sharing panel in the Yahoo calendar event edit screen doesn’t seem to include reminder information and I haven’t seen it done anywhere. If you absolutely need it I’d try looking for services that provide this feature and seeing how they do it. If you find an answer I’d be keen to hear it.
Wednesday 6th May, 2009 at 22:27 |
It was just as required. Thanks.
Y! Dev. Network didn’t had any such info.
Yours was really helpful
Thanks
Friday 4th December, 2009 at 12:53 |
Why msn url don’t work? Was change API? Healp me please.
Tuesday 5th January, 2010 at 10:16 |
@Lesaj, MSN calendar appears to have been replaced by Windows Live Calendar. The new calendar is implemented (predictably) in .NET rather than IIS DLLs like they used to use so the URL structure will be different. Do you still need help? What are you trying to do?