6

I am using the Facebook API to retrieve comments from my posts.

Most of the time, when there are more than 25 comments on a post, I am given this paging information:

{
//COMMENT DATA
  "paging": {
    "cursors": {
      "before": "",
      "after": "WTI5dGJXVnVkRjlqZAFhKemIzSTZAOekl4Tmprd016WTNNVFk0TXprNU1qb3hOalE0TmpZAM05UVXgZD"
    },
    "next": "https://graph.facebook.com/v12.0/165099760197787_7215028868538139/comments?access_token=ACCESS_TOKEN&pretty=1&limit=25&after=WTI5dGJXVnVkRjlqZAFhKemIzSTZAOekl4Tmprd016WTNNVFk0TXprNU1qb3hOalE0TmpZAM05UVXgZD"
  }
}

Or, if there isn't another page, I get this (no "next" value):

{
//COMMENT DATA
  "paging": {
    "cursors": {
      "before": "WTI5dGJXVnVkRjlqZAFhKemIzSTZAOekl4TlRNNU56QTJOVEUyTnprNE5qb3hOalE0TmpReE16WXkZD",
      "after": "WTI5dGJXVnVkRjlqZAFhKemIzSTZAOekl4Tmprd016WTNNVFk0TXprNU1qb3hOalE0TmpZAM05UVXgZD"
    }
  }
}

Everything works well with the above. But sometimes, I get paging information that doesn't have ANY paging cursors despite definitely having more than 25 comments. How am I supposed to page through the data with this? Any idea why it is giving me incomplete paging data? It looks like this:

{
//COMMENT DATA
  "paging": {
    "next": "https://graph.facebook.com/v12.0/165099760197787_1346071832565247/comments?access_token=ACESS_TOKEN&pretty=1&limit=25&after"
  }
}
Dan Williams
  • 171
  • 1
  • 7
  • 1
    Did you find any solution for this? I'm facing the same issue but couldn't find any official documentation for this – Araf Nov 08 '22 at 07:36
  • It helped me to add `&filter=stream` parameter to the request. Also maybe, moving the access token to the Authorization header makes the URLs a bit nicer to read if it has no direct effect on the pagination. – Finwe Mar 21 '23 at 12:37

0 Answers0