How can I post an anonymous comment on a blogger feed using the GData apis

8 views
Skip to first unread message

starbuxman

unread,
Dec 31, 2006, 8:55:39 PM12/31/06
to Google Data API
How can I post a comment to a blog anonymously?
The following code works but authenticates the person posting the
comment where as on the real blogger.com i can post comments
anonymously, as well.

// assume context is an obect i have setup to have the
appropriate values
GoogleService myService =
new GoogleService("blogger", context.getGoogleAppId());
myService.setUserCredentials(context.getGoogleLogin(),
context.getGooglePassword());

URL commentsUrl = new URL(blog.getCommentsUrl());

Entry e = new Entry();
e.setContent(new PlainTextConstruct("Why, helloooooo
worl!"));
e.setTitle(new PlainTextConstruct("the title of a new
comment"));
Person p=new Person("Anon" ,null, null );
e.getAuthors().add(p) ;
Entry entry = myService.insert(commentsUrl, e);

It doesnt seem to matter what I put in the Person object, the comment's
poster is always going to be whover gets logged in through
myService.setUserCredentials( .. , ... )

Is there a way to acheive "Anonymous" posting on the blog?

If I remove the setUseCredentials call, thent he blog posting fails
altogether with,


-------------------------------------------------------------------------------
Test set: basic
-------------------------------------------------------------------------------
Tests run: 1, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 6.219
sec <<< FAILURE!
testPostingAComment Time elapsed: 2.484 sec <<< FAILURE!
com.google.gdata.util.AuthenticationException: Unauthorized
<HTML>
<HEAD>
<TITLE>Unauthorized</TITLE>
</HEAD>
<BODY BGCOLOR="#FFFFFF" TEXT="#000000">
<H1>Unauthorized</H1>
<H2>Error 401</H2>
</BODY>
</HTML>

at
com.google.gdata.client.http.HttpGDataRequest.handleErrorResponse(Unknown
Source)
at
com.google.gdata.client.http.GoogleGDataRequest.handleErrorResponse(Unknown
Source)
at com.google.gdata.client.http.HttpGDataRequest.checkResponse(Unknown
Source)
at com.google.gdata.client.http.HttpGDataRequest.execute(Unknown
Source)
at com.google.gdata.client.http.GoogleGDataRequest.execute(Unknown
Source)
at com.google.gdata.client.Service.insert(Unknown Source)
at com.google.gdata.client.GoogleService.insert(Unknown Source)
at ...


Thanks in advance for any help, and happy new year for those who
haven't crossed yet!

Joshua Long
Sun Certified Java Developer
J2EE Developer Specializing in Spring, Tapestry, Maven and Java
technologies

Vivian ( Google )

unread,
Jan 3, 2007, 5:04:49 PM1/3/07
to Google Data API
starbuxman:

Posting anonymous comment is not supported via API.

In the future, you may want to post Blogger Data API related questions
at
http://groups.google.com/group/bloggerDev/.

Cheers,
Vivian

Reply all
Reply to author
Forward
0 new messages