3

I'm trying to get blogger post comments but getting null even though there are comments on the post.

https://www.googleapis.com/blogger/v3/blogs/2399953/posts/7706273476706534553/comments?key=API-KEY

Code

Google.Apis.Services.BaseClientService.Initializer service = new Google.Apis.Services.BaseClientService.Initializer();
service.ApiKey = "API-KEY";

BloggerService blogger = new BloggerService(service);

var blogQuery = blogger.Blogs.GetByUrl("http://buzz.blogger.com/");
var blog = blogQuery.Execute();

PostsResource.ListRequest query = blogger.Posts.List(blog.Id);
query.MaxResults = 500;

PostList result = query.Execute();

foreach (Post post in result.Items)
{
    CommentsResource.ListRequest commentsQuery = blogger.Comments.List(blog.Id, post.Id);
    commentsQuery.MaxResults = 500;
    CommentList comments = commentsQuery.Execute();
    post.Replies.Items = comments.Items;
}
Linda Lawton - DaImTo
  • 106,405
  • 32
  • 180
  • 449
Adnan Ahmed
  • 844
  • 6
  • 19
  • I,m getting the same problem. I only got success in playground using OAuth 2.0 https://developers.google.com/blogger/docs/3.0/reference/comments/get?apix=true – AllanRibas Jun 20 '22 at 03:48

1 Answers1

0

In my case it was a blogger setting, which was preventing comments from loading. In the settings go to website feed and activate the complete version. eureka enter image description here

AllanRibas
  • 678
  • 5
  • 14