HarvardEvents API

on the CS50 Wiki

Jump to: navigation, search

The HarvardEvents API allows you to request data programmatically HarvardEvents in CSV, iCalendar, or RSS format. The API provides a RESTful interface, which means that you can query it using simple HTTP GET requests.

HarvardEvents knows about events from 2008-09-18 onward. New events (or changes to old events) may take up to 24 hours to appear in HarvardEvents's database.

This is version 0.91 of this API. Version 1.0 (to be released by Fall 2010) will be significantly different (and more consistent with CS50's other APIs).

Contents

Author

To report bugs or request features, contact:

David J. Malan '99
http://www.cs.harvard.edu/malan/

License

Use of this API is governed by a Creative Commons Attribution-Noncommerical 3.0 Unported license, which means that you may use its data for non-commercial purposes so long as you attribute your data to this API, as by including a link to HarvardEvents in your own work. For approval of commercial purposes, contact the author.

Methods

events

To query the HarvardEvents API for events, contact the server via URLs in this format:

http://events.cs50.net/api/0.91/events?param1=value1&param2=value2&...

Supported parameters include:

parameter description
dtend Optional. An end date/time in YYYYMMDD or YYYYMMDDTHHMMSS format, where HH is in 24-hour time. (Don't overlook the T between YYYYMMDD and HHMMSS in the latter.) Events happening before or on this date/time will be returned. If omitted, the current date will be assumed.
output Required. Format for output. Must be csv, ics, or rss.
q Optional. Query string. Be sure to URL-encode this parameter's value (as with PHP's urlencode).
dtstart Optional. An end date/time in YYYYMMDD or YYYYMMDDTHHMMSS format, where HH is in 24-hour time. (Don't overlook the T between YYYYMMDD and HHMMSS in the latter.) Events happening on or after this date/time will be returned. If omitted, the current date will be assumed.

If any parameters are malformed or any required parameters are omitted, an empty response will be returned along with, possibly, HTTP status code 400 Bad Request.

CSV

If you request events in CSV format (e.g., http://events.cs50.net/api/0.91/events?output=csv), the response will be a series of comma-delimited rows, per the below:

cid,CALNAME,Subject,"Start Date","Start Time","End Date","End Time","All day event",Description,Location
82,"Faculty/Admin Registrar Calendar","Thanksgiving Recess.",11/28/2009,,,,TRUE,,
81,"GSAS Registrar Calendar","Thanksgiving Recess.",11/28/2009,,,,TRUE,,
83,"Undergrad Registrar Calendar","Thanksgiving Recess.",11/28/2009,,,,TRUE,,
52,"Varsity Athletic Events","Women's Varsity Basketball Coors Classic (vs. Georgia Southern or Colorado)",11/28/2009,,,,TRUE,,
59,"Home Varsity Athletic Events","Women's Varsity Soccer NCAA Quarterfinals",11/28/2009,,,,TRUE,,
52,"Varsity Athletic Events","Women's Varsity Soccer NCAA Quarterfinals",11/28/2009,,,,TRUE,,
77,"Outing/Off-Site Event","HOUSE CLOSED",11/28/2009,08:00,,23:00,FALSE,,

Note that the response's first row defines the CSV file's fields. Fields' order may change over time, so do not hardcode indices into your own code. Use that first row to determine fields' indices dynamically, per this article on parsing CSV.

iCalendar

If you request tweeters in iCalendar format (e.g., http://events.cs50.net/api/0.91/events?output=ics), the response wil be an iCalendar feed, per the below:

BEGIN:VCALENDAR
METHOD:PUBLISH
PRODID:-//216.38.51.62//NONSGML iCalcreator 2.6//
VERSION:2.0
X-WR-CALNAME:
BEGIN:VEVENT
UID:173155706
DTSTAMP:20091128T222517Z
DESCRIPTION:
DTSTART;VALUE=DATE:20091128
LOCATION:
SUMMARY:Thanksgiving Recess.
END:VEVENT
BEGIN:VEVENT
UID:173155705
DTSTAMP:20091128T222517Z
DESCRIPTION:
DTSTART;VALUE=DATE:20091128
LOCATION:
SUMMARY:Thanksgiving Recess.
END:VEVENT
BEGIN:VEVENT
UID:173155707
DTSTAMP:20091128T222517Z
DESCRIPTION:
DTSTART;VALUE=DATE:20091128
LOCATION:
SUMMARY:Thanksgiving Recess.
END:VEVENT
BEGIN:VEVENT
UID:202541546
DTSTAMP:20091128T222517Z
DESCRIPTION:
DTSTART;VALUE=DATE:20091128
LOCATION:
SUMMARY:Women's Varsity Soccer NCAA Quarterfinals
END:VEVENT
BEGIN:VEVENT
UID:202545488
DTSTAMP:20091128T222517Z
DESCRIPTION:
DTSTART;VALUE=DATE:20091128
LOCATION:
SUMMARY:Women's Varsity Soccer NCAA Quarterfinals
END:VEVENT
BEGIN:VEVENT
UID:197377234
DTSTAMP:20091128T222517Z
DESCRIPTION:
DTSTART;:20091128T080000
DTEND;:20091128T230000
LOCATION:
SUMMARY:HOUSE CLOSED
END:VEVENT
BEGIN:VEVENT
UID:calendar:1167:field_regular_schedule:1:306
DTSTAMP:20091128T222517Z
DESCRIPTION:http://hillel.harvard.edu/events/2009/11/21/hillel-homeless-she
 lter-shift<p>The Orthodox Student Minyan is teaming up with the Progressiv
 e Jewish Alliance to fill a weekly shift on Saturdays from 9-11:15PM at th
 e Harvard Square Homeless Shelter.  During our shift we'll be chatting wit
 h guests\, cleaning up after dinner\, and helping out around the shelter.<
 /p>
DTSTART;:20091128T210000
DTEND;:20091128T231500
LOCATION:
SUMMARY:Hillel Homeless Shelter Shift
END:VEVENT
END:VCALENDAR

RSS

If you request events in RSS format (e.g., http://events.cs50.net/api/0.91/events?output=rss), the response will be a serialized array of associative arrays, per the below:

<rss version='2.0'>
  <channel>
    <title>HarvardEvents</title>
    <description></description>
    <link>http://events.cs50.net/</link>
    <item>
      <guid isPermaLink='false'>173155706</guid>
      <title>Thanksgiving Recess.</title>
      <link>http://events.cs50.net/</link>
      <description>
        <![CDATA[<p>
</p><p></p>]]>
</description>
      <category></category>
      <pubDate>Sat, 28 Nov 2009 00:00:00 -0500</pubDate>
    </item>
    <item>
      <guid isPermaLink='false'>173155705</guid>
      <title>Thanksgiving Recess.</title>
      <link>http://events.cs50.net/</link>
      <description>
        <![CDATA[<p></p><p></p>]]>
</description>
      <category></category>
      <pubDate>Sat, 28 Nov 2009 00:00:00 -0500</pubDate>
    </item>
    <item>
      <guid isPermaLink='false'>173155707</guid>
      <title>Thanksgiving Recess.</title>
      <link>http://events.cs50.net/</link>
      <description>
        <![CDATA[<p></p><p></p>]]>
</description>
      <category></category>
      <pubDate>Sat, 28 Nov 2009 00:00:00 -0500</pubDate>
    </item>
    <item>
      <guid isPermaLink='false'>202541546</guid>
      <title>Women's Varsity Soccer NCAA Quarterfinals</title>
      <link>http://events.cs50.net/</link>
      <description>
        <![CDATA[<p></p><p></p>]]>
</description>
      <category></category>
      <pubDate>Sat, 28 Nov 2009 00:00:00 -0500</pubDate>
    </item>
    <item>
      <guid isPermaLink='false'>202545488</guid>
      <title>Women's Varsity Soccer NCAA Quarterfinals</title>
      <link>http://events.cs50.net/</link>
      <description>
        <![CDATA[<p></p><p></p>]]>
</description>
      <category></category>
      <pubDate>Sat, 28 Nov 2009 00:00:00 -0500</pubDate>
    </item>
    <item>
      <guid isPermaLink='false'>197377234</guid>
      <title>HOUSE CLOSED</title>
      <link>http://events.cs50.net/</link>
      <description>
        <![CDATA[<p></p><p></p>]]>
</description>
      <category></category>
      <pubDate>Sat, 28 Nov 2009 08:00:00 -0500</pubDate>
    </item>
    <item>
      <guid isPermaLink='false'>
      calendar:1167:field_regular_schedule:1:306</guid>
      <title>Hillel Homeless Shelter Shift</title>
      <link>http://events.cs50.net/</link>
      <description>
        <![CDATA[<p></p><p><a href="http://hillel.harvard.edu/events/2009/11/21/hillel-homeless-shelter-shift" target="_blank" >http://hillel.harvard.edu/events/2009/11/21/hillel-homeless-shelter-shift</a> The Orthodox Student Minyan is teaming up with the Progressive Jewish Alliance to fill a weekly shift on Saturdays from 9-11:15PM at the Harvard Square Homeless Shelter.  During our shift we&#039;ll be chatting with guests, cleaning up after dinner, and helping out around the shelter. </p>]]>
</description>
      <category></category>
      <pubDate>Sat, 28 Nov 2009 21:00:00 -0500</pubDate>
    </item>
  </channel>
</rss>

Examples

See Also

Related APIs

External Links

Changelog

  • 0.9
  • 0.91
    • Added calendar IDs and CALNAMEs to CSV output of events method.
Personal tools