I am writing an iGoogle gadget, which calls the calendar API to add and read events from its own calendar within a user's collection. So far, I've managed to get OAuth working, and retrieved a list of calendars, now I'm trying to create the requested calendar name if it doesn't exist.
I create an xml string, and send it to the url as documented in the Calendar API, but no luck... I get a 400 header and "com.sun.syndication.io.ParsingFeedException: Invalid XML" every time. I don't get any more detail than that. Can anyone help me with this? Code snippets follow: var newCal = ''; newCal = newCal + '<entry xmlns=\'http://www.w3.org/2005/Atom\''; newCal = newCal + ' xmlns:gd=\'http://schemas.google.com/g/2005\''; newCal = newCal + ' xmlns:gCal=\'http://schemas.google.com/gCal/2005\'>'; newCal = newCal + ' <title type=\'text\'>P-Budget</title>'; newCal = newCal + ' <summary type=\'text\'>This calendar was created for the Cal-Budget iGoogle gadget.</summary>'; newCal = newCal + ' <gCal:timezone value=\'Europe/London\'></gCal:timezone>'; newCal = newCal + ' <gCal:hidden value=\'false\'></gCal:hidden>'; newCal = newCal + ' <gCal:color value=\'#2952A3\'></gCal:color>'; newCal = newCal + '</entry>'; var url = 'http://www.google.com/calendar/feeds/default/owncalendars/full'; var headers = { "Content-Type": "application/atom+xml" }; fetchData(url,newCalResponse,newCal,"POST",headers); then in fetchData, the following code: var params = {}; params[gadgets.io.RequestParameters.CONTENT_TYPE] =gadgets.io.ContentType.FEED; params[gadgets.io.RequestParameters.AUTHORIZATION] =gadgets.io.AuthorizationType.OAUTH; params[gadgets.io.RequestParameters.OAUTH_SERVICE_NAME] = "google"; params[gadgets.io.RequestParameters.OAUTH_USE_TOKEN] = "always"; params[gadgets.io.RequestParameters.METHOD] = eval("gadgets.io.MethodType."+pMethod); params[gadgets.io.RequestParameters.NUM_ENTRIES] = 100; params[gadgets.io.RequestParameters.GET_SUMMARIES] = true; if (pData) {params[gadgets.io.RequestParameters.POST_DATA] = pData;} if (pHeaders) {params[gadgets.io.RequestParameters.HEADERS] =pHeaders;} gadgets.io.makeRequest(url, function (response) {}, params); (I've snipped the content of the response function for ease of reading) Others have tried posting this xml to that URL, and say it works, so the error must be in the set of params I am posting to the makeRequest function (or some other obscure conflict of settings somewhere). Has anyone tried using this method from within a gadget? Can anyone see anything obviously wrong with what I'm trying? The full gadget code is available here. http://hosting.gmodules.com/ig/gadgets/file/117332718031107708419/P-Budget.xml Please help! Thanks, Rich Sent from London, Eng, United Kingdom --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Google Calendar Data API" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/google-calendar-help-dataapi?hl=en -~----------~----~----~----~------~----~------~--~---
