There is a Java library which is hosted at http://code.google.com/p/gdata-java-client/. Currently, the code is maintained using ant. We use maven2 to build our project, so we manually uploaded those jars to our maven repository and added necessary pom files. Dependencies of gdata java library are described at http://code.google.com/p/gdata-java-client/wiki/Dependencies.
Google Picasa doc: http://code.google.com/apis/picasaweb/docs/2.0/developers_guide.html
Google Calendar doc: http://code.google.com/apis/calendar/docs/2.0/developers_guide.html
During using of Google Calendar APIs, one thing I want to do is publish a new event to a specific non-primary calendar. According to http://code.google.com/apis/calendar/docs/2.0/developers_guide_protocol.html#CreatingSingle, POST requests should be sent to http://www.google.com/calendar/feeds/default/private/full. However that results in putting new event to primary calendar. The document does not tell us how to put a new event to non-primary calendar.
Solution (How to publish a new event to a non-primary calendar)
Steps:- Get a list of all calendars owned by the user
Send GET request to http://www.google.com/calendar/feeds/default/owncalendars/full - In the response feed, each calendar has an entry.
Each entry should has a link element like this:
<link rel="alternate"
type="application/atom+xml"
href="http://www.google.com/calendar/feeds/pnk4d66rpmiho1pl0m4t6dnki0%40group.calendar.google.com/private/full"/>
Value of attribute href is the URL to which the POST request should be sent to create a new event in the corresponding calendar. - Send POST request to the URL specified by attribute "href" found in step 2)
Example of POST data is shown http://code.google.com/apis/calendar/docs/2.0/developers_guide_protocol.html#CreatingSingle
No comments:
Post a Comment