Backpack API

Introduction to the Calendar API

The Backpack calendar API is implemented as vanilla XML over HTTP. Be sure to set the "Content-Type" header in your requests to "application/xml", which will identify the format of the data being sent. Example with Curl:

curl -H 'Content-Type: application/xml' -d '<request>...</request>' \ 
    http://david.backpackit.com/calendar_events.xml

Authentication happens by accessing a url that belongs to the user, like http://david.backpackit.com, and by passing in the web service token with the custom X-BP-Token header. The token is a 40-char SHA1 hash and can be found on your account page. The token represents your password for use with web services, so don't distribute it - that would be like giving your password away. Abuse the token and it can be revoked. All requests to the calendar API must include your token. Here is an example with Curl:

curl -H 'Content-Type: application/xml' \ 
  -H 'X-BP-Token: 40bd001563085fc35165329ea1ff5c5ecbdbbeef' \
  http://david.backpackit.com/calendar_events/35.xml

If a request fails, the error information is returned with the HTTP status code. For instance, if a requested record could not be found, the HTTP response might look something like:

HTTP/1.1 404 The record could not be found
Date: Thu, 16 Mar 2006 17:41:40 GMT
...

Note that, in general, if a request causes a new record to be created (like a new message, or to-do item, etc.), the response will use the "201 Created" status. Any other successful operation (like a successful query, delete, or update) will use a 200 status code.

SSL Note: A request made against an account that has SSL turned on will get a redirect answer back. Be sure to call over https for an account that requires that.

In the documentation that follows, the following notation is used:

Sample client

You can take a look at a sample Ruby client of the API for reference.

Calendars

list all calendars: GET /calendars.xml

This will return all calendars for the specified account. Most of the fields of a calendar are self-explanatory. The token is for calendar sharing. It is used in urls of the form webcal://your-account.backpackit.com/#{token}.ics.

Response

<calendars>
  <calendar>
    <account-id type="integer">11</account-id>
    <color>000099</color>
    <created-at type="datetime">#{created_at}</created-at>
    <ical-subscription-url></ical-subscription-url>
    <id type="integer">5</id>
    <name>Personal</name>
    <token>520</token>
    <updated-at type="datetime">#{updated_at}</updated-at>
  </calendar>
</calendars>

Events

create an event: POST /calendar_events.xml

Creates a new event. Required fields are the title for the event as well as the calendar_id of the calendar you would like the event to be added to. The Location header will be set to the url of the newly created calendar event.

XML request

<request>
  <event>
    <calendar-id>#{calendar_id}</calendar-id>
    <title>9/27 Dinner with mom</title>
    <!-- optional -->
    <remind>1</remind>
  </event>
</request>

Response

Status: 201 Created

show an event: GET /calendar_events/#{event_id}.xml

This will return information about the referenced event.

Response

<calendar-event>
  <calendar-id type="integer">5</calendar-id>
  <id type="integer">21</id>
  <title>Dinner with Jamis</title>
  <remind type="boolean">false</remind>
  <occurs-at type="datetime">2006-10-06T00:00</occurs-at>
  ...
</calendar-event>

Data Reference

The following section describes the format of the types of data used in the API responses.

calendar

<calendar>
  <account-id type="integer">11</account-id>
  <color>000099</color>
  <created-at type="datetime">2006-09-27T20:32:15Z</created-at>
  <ical-subscription-url></ical-subscription-url>
  <id type="integer">5</id>
  <name>Personal</name>
  <token>520</token>
  <updated-at type="datetime">2006-09-27T20:32:15Z</updated-at>
</calendar>

calendar event

<calendar-event>
  <all-day type="boolean">true</all-day>
  <calendar-id type="integer">5</calendar-id>
  <created-at type="datetime">2006-09-21T20:59:19Z</created-at>
  <id type="integer">21</id>
  <message>dinner with lisa</message>
  <occurs-at type="datetime">2006-10-06T00:00:00Z</occurs-at>
  <occurs-until type="datetime"></occurs-until>
  <remind type="boolean">false</remind>
  <reminded-at type="datetime"></reminded-at>
  <title>dinner with lisa</title>
  <updated-at type="datetime">2006-09-21T20:59:19Z</updated-at>
</calendar-event>