MauroMaxxa
MauroMaxxa

Reputation: 59

Facebook Graph get photos of public page pagination

I successfully managed to retrieve first 50 photos of a public page via FBGraph but can't make pagination work

1525666877712653?fields=albums{id,photos.limit(50){name,picture}}

Here's, for example, how I get them from CocaCola's public page. But how can I get 50 more?

Upvotes: 1

Views: 111

Answers (1)

Stéphane Bruckert
Stéphane Bruckert

Reputation: 22953

When doing

1525666877712653?fields=albums{id,photos.limit(50){name,picture}}

You will get:

{
  "data": [
     ... Endpoint data is here
  ],
  "paging": {
  "cursors": {
      "after": "MTE1NzQxNDAwODUwNA==", 
      "before": "MTU0MjU3NDQ3NzI3NQ=="
    }, 
  "next": "https://graph.facebook.com/v2.3/1525666877712653/albums?fields=id,photos.limit(50){name,picture}&limit=25&after=MTE1NzQxNDAwODUwNA=="
}

And use the query you can get from the next field to get the results from 50 to 100. You will see that the filters are the same as in your initial query.

Upvotes: 1

Related Questions