I don't see that the Google JS API has methods to POST comments. I
think that you'll have to roll your own, using the XMLHTTPRequest
object, or maybe one of the JS libraries has some interface to the
HTTP methods.

I have posted essentially all my code for doing this. I'm using Ruby
to POST XML strings. There's not much more to it.

I am surprised that you don't see your comments. If there were a
problem with cross site authentication, I don't think that your
comment POSTs would succeed. I would think that you would get an error
code.

Ray

On Tue, Feb 3, 2009 at 12:03 PM, Dag <[email protected]> wrote:
>
> But how do you do the POST? is it 'insertEntry' ?
> Could you post your code, especially the part that does the POST?
>
> Thank you,
> Tim
> BTW, I have read your other postings discussing getting the comment
> feed etc. They were helpful. I can add a comment through the GUI, get
> hold of the comment feed in javascript and even add to that comment
> feed. I checked this by examining the entries in the comment field and
> printing them to console.
>
> console.log('entries length', entries.length);
> console.log(entries[0].getId().getValue());
> console.log(entries[0].getContent().getText());
> However the comment is gone the next time I get hold of the comment
> feed. NOTE: I am using a local copy of
> http://gdata-javascript-client.googlecode.com/svn/trunk/samples/calendar/meeting_notes/meeting_notes.html
>
> Maybe there is a problem with cross site authentication?
> THANKS!
>
> On Feb 2, 8:29 pm, Ray Baxter <[email protected]> wrote:
>> You need to POST to the comment feed url.
>>
>> http://www.google.com/calendar/feeds/userID/visibility/full/eventID/c...
>>
>> Also, do you know that the comments are not included in a full feed?
>> To see comments, you need to request either the comment feed url, or a
>> composite feed.
>>
>> I just created an event through the UI and added and comment, also
>> through the UI. Once I had that, I requested the comment feed for my
>> new event, and saw the original comment. Then I was able to
>> successfully POST an number of comments to the comment feed url.
>>
>> The full xml that I posted was:
>>
>> <entry xmlns="http://www.w3.org/2005/Atom";>
>> <content type="html">Hello</content>
>> <author><name>Calendar
>> Maven</name><email>[email protected]</email></author>
>> </entry>
>>
>> This comment appears in the comment feed and in the UI. If you don't
>> make the content type="html" then the content does not appear in the
>> UI. I'm not sure why that is.
>>
>> Ray
>>
>> On Mon, Feb 2, 2009 at 6:47 PM,Dag<[email protected]> wrote:
>>
>> > How do you do the POST? I tried adding this function
>>
>> > function postwith(to,p) {
>> >  var myForm = document.createElement("form");
>> >  myForm.method="post" ;
>> >  myForm.enctype = "application/atom+xml";
>> >  myForm.action = to ;
>> >  for (var k in p) {
>> >    var myInput = document.createElement("input") ;
>> >    myInput.setAttribute("name", k) ;
>> >    myInput.setAttribute("value", p[k]);
>> >    myForm.appendChild(myInput) ;
>> >  }
>> >  document.body.appendChild(myForm) ;
>> >  myForm.submit() ;
>> >  document.body.removeChild(myForm) ;
>> > }
>>
>> > but that won't change the enctype.
>>
>> > I tried to call POST on the google.gdata.calendar.CalendarService
>> > object but it isn't supported.
>>
>> > Also I tried:
>> > var feed = feedRoot.feed;
>> > var entries = feed.entry;
>> > console.log('entries length', entries.length);
>> > console.log(entries[0].getId().getValue());
>> > console.log(entries[0].getContent().getText());
>> >  //feed.insertEntry(ce, hie, herror);
>> > feed.addEntry(ce);
>>
>> > And the entry was inserted into the feed but it doesn't stay in there.
>> > The next time I look at the feed, the added comment is gone.
>> > I know there is something tricky going on because none of google's
>> > examples are examples of adding comments.
>> > What is the secret?
>> > Thanks,
>> > Tim
>>
>> > On Jan 31, 10:20 pm, Ray Baxter <[email protected]> wrote:
>> >> Yourcommentxml should look like the example 
>> >> here:http://code.google.com/apis/gdata/elements.html#gdComments
>>
>> >> Ray
>>
>> >> On Wed, Jan 28, 2009 at 3:39 AM, talby101
>>
>> >> <[email protected]> wrote:
>>
>> >> > Hi there I am trying to post acommentto my event using the data api
>> >> > but failing with a HTTP 500 error - Error addingcomment. I really
>> >> > wish i could RTFM but the docs are pretty scant on this one (if not
>> >> > please notify)...
>>
>> >> > (All i could find doc wise : 
>> >> > ttp://code.google.com/support/bin/answer.py?answer=64265&topic=10365
>> >> > )
>>
>> >> > Here is my post:
>>
>> >> > <atom:entry   xmlns:atom='http://www.w3.org/2005/Atom'
>> >> >                        xmlns:gd='http://schemas.google.com/g/2005'
>> >> >                        xmlns:gCal='http://schemas.google.com/gCal/
>> >> > 2005'
>> >> >                        xmlns:gAcl='http://schemas.google.com/acl/
>> >> > 2007'
>> >> >                        xmlns:batch='http://schemas.google.com/gdata/
>> >> > batch'>
>> >> > <atom:category scheme='http://schemas.google.com/g/2005#kind'
>> >> > term='http://schemas.google.com/g/2005#message'/>
>> >> > <atom:content type='text'>some text</atom:content>
>> >> > <atom:author>
>> >> > <atom:name>some name</atom:name>
>> >> > <atom:email>some email</atom:email>
>> >> > </atom:author>
>> >> > </atom:entry>
>>
>> >> > Can anyone see anything wrong with that ? My content type is
>> >> > application/atom+xml and method is POST.
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to