Search code examples
facebookfacebook-graph-apifacebook-field-expansion

How can I use cursors to paginate field-expanded queries?


I can do this:

/<post_id>/comments?filter=stream&limit=100&after=<cursor>

But this doesn't work:

/<post_id>?fields=comments.filter(stream).limit(100).after(<cursor>)

Am I missing something in the syntax? Though cursor-based paging and field expansion were launched a the same time, their respective docs don't reflect each other.


Solution

  • Just figured this out (I think).

    Most cursors have an = (equals sign) appended to them. For example: MzA=

    This causes this syntax error in field expansion:

    Syntax error "Expected ")" instead of '".' at character 79: comments.filter(stream).limit(10).summary(true).fields(id,like_count).after(NDA"

    However, stripping the trailing = resolves the syntax error and results seem to paginate as expected.