1. authenticate the user for access to their list of blogs.
2. get the user's list of blogs and iterate through them, examining
the title as in the example (see the link to the Retrieving Metafeed
example below).
3. when you find the blog with the right title in the list, you can
get its blogId by calling getId() on the Entry object (see the javadoc
on Entry's parent class, BaseEntry:
http://code.google.com/apis/gdata/javadoc/com/google/gdata/data/BaseEntry.html#getId()
AND compare that method to the Atom feed Schema reference for a user's
blog list: http://code.google.com/apis/blogger/docs/2.0/schema/blog_atom.rnc
).
4. once you have the blogId (specifically, the ID of one of the
Entries in the Blog List of the Authenticated User or Manually Entered
User), change the URL in your code to URL("http://www.blogger.com/
feeds/" + blogId + "/posts/default") and then try your program again.
If you don't want to go through all that, and instead just want to
manually enter a blogId, go to the blog whose ID you want, view the
page source, and search for "blodID=". The number that follows is the
blog's ID. Be sure you change your URL to the correct one as in Step
4!
Steps 1 & 2 can be learned from
http://code.google.com/apis/blogger/docs/2.0/developers_guide_java.html#RetrievingMetafeed
I would also like to add to their explanation in the Retrieving
Metafeed example above of how to manually enter the user ID, which
apparently allows you to bypass authentication in Step 1. I believe
that in their explanation under the code, what they mean by "different
user" is a user other than the one who is currently authenticated:
"[ http://www.blogger.com/feeds/default/blogs ] is the default
metafeed URL; it returns a list of blogs for the currently
authenticated user. To access a feed for a different
[unauthenticated] user, you can put the [unauthenticated] user's ID in
place of [the word] default in the metafeed URL [ which would look
like this-> http://www.blogger.com/feeds/differentUserId/blogs ]. The
[unauthenticated] user's ID is the string of digits at the end of the
user's profile URL [ which looks like this-> http://www.blogger.com/profile/userId
]."
It's all very confusing the way they worded it because if a person is
not authenticated and you have to manually enter their userId, then
they are not necessarily the user.
--Aratina Cage
On Oct 1, 8:08 am, wkoscho <wkos...@gmail.com> wrote:
> I would like to execute read-only text queries against the
> BloggerService but I get errors unless I pass blogid. Is there a way
> to execute read-only queries without blogId ?
>
> Also, i'm not sure what URL to use even if this is possible, all of
> the examples pass blogid in the URL.
>
> Any help is appreciated; sample code would be great if someone knows
> how to do this.
>
> The code I'm currently using is:
>
> // Is this URL correct?
> URL feedUrl = new URL("http://www.blogger.com/feeds/posts/
> default");
>
> Query query = new Query(feedUrl);
> query.setFullTextQuery(textQuery);
>
> BloggerService bservice = new BloggerService("myapplication");
> Feed resultFeed = bservice.query(query, Feed.class);
>
> Thanks
> Bill
--
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