Search This Site

Custom Search

Friday, July 23, 2010

Re: [bloggerDev] I can't send post via API

Do you have one account for App Engine and another for Blogger? It seems that you're using your App Engine account where you should use your Blogger account. Please try to login on blogger.com using that account and check whether it works.

Jinwoo

On Fri, Jul 23, 2010 at 11:13 AM, tleroy <contact@arobass.com> wrote:
Hi everybody,

I use this code :

GoogleService myService = new GoogleService("blogger", "");
       try {
           myService.setUserCredentials("xxxx", "xxxx");
           createPost(myService, "8255690984818830283", "Blah Blah Blah",
"Blah Blah",  true);
       } catch (AuthenticationException e) {
           // TODO Auto-generated catch block
           e.printStackTrace();
       } catch (ServiceException e) {
           // TODO Auto-generated catch block
           e.printStackTrace();

       } catch (IOException e) {
           // TODO Auto-generated catch block
           e.printStackTrace();
       }


public static com.google.gdata.data.Entry createPost(GoogleService
myService, String blogId, String title, String content,  Boolean
isDraft) throws ServiceException, IOException {
       // Create the entry to insert
       com.google.gdata.data.Entry myEntry = new
com.google.gdata.data.Entry();
       myEntry.setTitle(new PlainTextConstruct(title));
       myEntry.setContent(new PlainTextConstruct(content));
       myEntry.setDraft(isDraft);
       myEntry.setService(myService);
       // Ask the service to insert the new entry
       URL postUrl = new URL("http://www.blogger.com/feeds/" +  blogId + "/
posts/default");
       return myService.insert(postUrl, myEntry);
   }

I get this error message :
com.google.gdata.util.AuthenticationException: Unauthorized
User does not have permission to create new post
       at
com.google.gdata.client.http.HttpGDataRequest.handleErrorResponse(HttpGDataRequest.java:
596)
       at
com.google.gdata.client.http.GoogleGDataRequest.handleErrorResponse(GoogleGDataRequest.java:
563)
       at
com.google.gdata.client.http.HttpGDataRequest.checkResponse(HttpGDataRequest.java:
550)
       at
com.google.gdata.client.http.HttpGDataRequest.execute(HttpGDataRequest.java:
530)
       at
com.google.gdata.client.http.GoogleGDataRequest.execute(GoogleGDataRequest.java:
535)
       at com.google.gdata.client.Service.insert(Service.java:1409)
       at com.google.gdata.client.GoogleService.insert(GoogleService.java:
599)

Aa another thing is that authentication work if I use my App Engine
pasword but not with my Blogger pasword I use to connect to the web
interface. I don't if it's linked.

can you help me?


--
You received this message because you are subscribed to the Google Groups "Blogger Developer Group" group.
To post to this group, send email to bloggerdev@googlegroups.com.
To unsubscribe from this group, send email to bloggerdev+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/bloggerdev?hl=en.


--
You received this message because you are subscribed to the Google Groups "Blogger Developer Group" group.
To post to this group, send email to bloggerdev@googlegroups.com.
To unsubscribe from this group, send email to bloggerdev+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/bloggerdev?hl=en.

No comments:

Post a Comment