Apr 25, 2006
[WebService] Google Calendar API にチャレンジ
Google Calendar も API が公開されていたのでサワリだけ試してみた。
- Using the Google Calendar Data API
- http://code.google.com/apis/gdata/calendar.html
API 経由で Google Calendar にアクセス
Google Calendar に API 経由でアクセスするためには、まずアクセスしたいカレンダーの URL を調べなければならない。
- Google Calendar に Web ブラウザでアクセス
- Calendars > My Calendars > アクセスしたいカレンダー > Calendar settings を選択
- Private Address の "XML" アイコンのリンク先 URL をコピーする
http://www.google.com/calendar/feeds/in-vitro.example@gmail.com/private-1234567890abcdef1234567890abcdef/basicにアクセスすると
という感じの XML を取得できる。 尚、上記のリクエスト、レスポンス共にダミーなのでそのままコピペしても当然無効。<?xml version='1.0' encoding='UTF-8'?> <feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:gd='http://schemas.google.com/g/2005'> <id> http://www.google.com/calendar/feeds/in-vitro-example%40gmail.com/private-1234567890abcdef1234567890abcdef/basic </id> <updated>2006-04-24T01:05:34.000Z</updated> <title type='text'>private</title> <subtitle type='text'>private</subtitle> <link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://www.google.com/calendar/feeds/in-vitro-example%40gmail.com/private-1234567890abcdef1234567890abcdef/basic'> </link> <link rel='self' type='application/atom+xml' href='http://www.google.com/calendar/feeds/in-vitro-example%40gmail.com/private-1234567890abcdef1234567890abcdef/basic?max-results=25'> </link> <link rel='next' type='application/atom+xml' href='http://www.google.com/calendar/feeds/in-vitro-example%40gmail.com/private-1234567890abcdef1234567890abcdef/basic?start-index=26&max-results=25'> </link> <author> <name>in-vitro-example</name> <email>in-vitro-example@gmail.com</email> </author> <generator version='1.0' uri='http://www.google.com/calendar'> Google Calendar </generator> <openSearch:itemsPerPage>25</openSearch:itemsPerPage> <entry> <id> http://www.google.com/calendar/feeds/in-vitro-example%40gmail.com/private-1234567890abcdef1234567890abcdef/basic/1357913579abcdefabcdef2468 </id> <published>2006-04-15T04:30:00.000Z</published> <updated>2006-04-15T14:43:51.000Z</updated> <category scheme='http://schemas.google.com/g/2005#kind' term='http://schemas.google.com/g/2005#event'> </category> <title type='text'>○○さん、××さんと昼食</title> <summary type='html'> When: 2006-04-14 21:30:00 to 00:00:00 America/Los_Angeles<br> </summary> <content type='text'> When: 2006-04-14 21:30:00 to 00:00:00 America/Los_Angeles<br><br>Event Description:null </content> <link rel='alternate' type='text/html' href='http://www.google.com/calendar/event?eid=fedcba0987654321fedcba0987654321fedbca0987654321fedbca098765' title='alternate'> </link> <link rel='self' type='application/atom+xml' href='http://www.google.com/calendar/feeds/in-vitro-example%40gmail.com/private-1234567890abcdef1234567890abcdef/basic/1357913570abcdefabcdef2468'> </link> <author> <name>in-vitro-example</name> <email>in-vitro-example@gmail.com</email> </author> </entry> </feed>
Google Calendar API のリクエスト URL フォーマット
Google Calendar API に対するリクエスト URL は
http://www.google.com/calendar/feeds/<userID>/<visibility>/<projection>という形式になっている。 visibility、projection に指定可能な値は
- Visibility values
- http://code.google.com/apis/gdata/calendar.html#Visibility
- Projection values
- http://code.google.com/apis/gdata/calendar.html#Projection



