Mark, You don't need to add the xml header to your data.
Assuming you have authentication working, just this is sufficient: data = "<entry xmlns='http://www.w3.org/2005/Atom' xmlns:gCal='http://schemas.google.com/gCal/2005' xmlns:gd='http://schemas.google.com/g/2005'> <id>c4o4i7m2lbamc4k26sc2vokh5g%40group.calendar.google.com</id></entry>" response = post_data('https://www.google.com/calendar/feeds/default/allcalendars/full', data) Google's example, shown here: http://code.google.com/apis/calendar/developers_guide_protocol.html#AddingSubscriptions is even shorter since you don't really need the other namespaces, besides Atom, data = data = "<entry xmlns='http://www.w3.org/2005/Atom'> <id>c4o4i7m2lbamc4k26sc2vokh5g%40group.calendar.google.com</id></entry>" I was able to add the secondary calendar, with just that data. Ray On Mon, Sep 29, 2008 at 2:40 PM, Mark <[EMAIL PROTECTED]> wrote: > > Hi Ray, I'd love to see the sample that would be really helpful. > > I tried setting the content type but got the same result, maybe I > didn't do it right though! I put it in as another tag in the xml. > > Thanks, > > Mark > > On Sep 29, 10:10 pm, "Ray Baxter" <[EMAIL PROTECTED]> wrote: >> I have a working sample of this code, but I can't access it right now. >> I'll check on it tonight. >> >> In the meanwhile, are you setting the content type to application/atom+xml? >> >> Ray >> >> On Mon, Sep 29, 2008 at 6:08 AM, Mark <[EMAIL PROTECTED]> wrote: >> >> > Hi all, I'm trying to programmatically sign up a user to a calendar in >> > a ruby on rails app. >> >> > Here's my code: >> >> > def add_calendar_subscription(calendar_id) >> > begin >> > srv = GoogleCalendar::Service.new(@email, @password) >> > calendar_id = "c4o4i7m2lbamc4k26sc2vokh5g >> > %40group.calendar.google.com" >> >> > target_url = 'www.google.com' >> > path = '/calendar/feeds/default/allcalendars/full' >> > http = Net::HTTP.new(target_url) >> >> > xml_request = "<?xml version='1.0'?> >> > <entry xmlns='http://www.w3.org/2005/Atom'> >> > <id>#{calendar_id}</id> >> > </entry>" >> >> > xml_response = http.post(path, xml_request) >> > puts xml_response.body >> >> > rescue GoogleCalendar::AuthenticationFailed >> > RAILS_DEFAULT_LOGGER.warn "[EMAIL PROTECTED] authentication >> > failure for >> > Google Cal" >> > end >> > end >> >> > I get an error: #<Net::HTTPUnsupportedMediaType 415 Unsupported Media >> > Type readbody=true> >> >> > when trying to set the xml_response variable. >> >> > Is my XML correct? I can't find any information on how it should look >> > other >> > thanhttp://code.google.com/apis/calendar/developers_guide_protocol.html#A... >> > which I used as a model for mine. >> >> > Any help would be greatly appreciated! >> >> > Mark > > > > --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
