5

I'm using Blogger API v3 to list a number of comments of a blog.

The issue is that I want to list all comments from a blog and the first request doesn't return directly all the needed comments (because I choose to return 10 comments per request for pagination reasons) and I have to use the nextPageToken parameter and make another request to get remaining comments (I may need many requests till i get all commments).

  1. The response is paginated because there are more than 10 comments.
  2. Those comments are sorted in ascending.

This problem can be solved simply by reverse sorting and it will require then just one request to return the needed comments.

So, is there anyway i can sort the comments in descending order?

The Documentation does not give any information about this

Bouh
  • 1,303
  • 2
  • 10
  • 24
JideGuru
  • 7,102
  • 6
  • 26
  • 48
  • Is your main requirement for needing comments in descending order due to pagination (aka in the pagination section it is something like "1 2 3 4 .... Last". And it is not possible for the user to open the last page unless we first iterate over all the pages to the get `nextPageToken` for the subsequent page)? – Prayag Verma Aug 21 '20 at 18:17
  • Yeah, I think changing the sorting is not a supported feature, definitely not documented. Have you considered pre-fetching all the comments? That would be a workaround, but not ideal... – Garrett Motzner Aug 25 '20 at 17:00
  • @GarrettMotzner As you said, pre-fetching the comments is not ideal, that's why it's not an option for me. It can cause lags in my app – JideGuru Aug 25 '20 at 17:07
  • If there is a way to sort comments by reverse order in the regular blogger UI then maybe this is possible through some undocumented apis. But as it looks like none of the resources let you reverse the sort order (some let you change the sort field), it likely is not implemented on the API. So you probably need to fix the lag issue and prefetch, sadly. – Garrett Motzner Aug 25 '20 at 17:25

0 Answers0