0

How do I return a set of results that is unlimited in size from Facebook Workplace's Graph API? It is limited by default to 25, but I can manually increase this by introducing the limit parameter.

https://graph.facebook.com/<company_id>/members?limit=500

I can obviously use a limit value way in excess of anything I'll need, but that just seems messy. Is there a way to prevent Facebook from limiting the number of results returned?

Igor Milla
  • 2,767
  • 4
  • 36
  • 44
ryansin
  • 1,735
  • 2
  • 26
  • 49
  • 1
    no, there is no unlimited option. you should use paging. – andyrandy Jun 12 '17 at 11:58
  • Thanks @luschn, if you phrase that as an answer with an example of how to implement paging then I'll mark it as the solution – ryansin Jun 12 '17 at 13:08
  • @Sinfieldd: I am also developing a workplace api using python to extract the data. I have an access token but do not have a Community ID. I am not sure on how to get it from workplace? Would be great if you could please share some info. about it – user3447653 Aug 16 '17 at 18:32
  • The community ID is available in the admin section of Workplace – ryansin Aug 19 '17 at 13:48

1 Answers1

1

There is no option to get unlimited results, you can use paging to get all of them - with a recursive function, for example.

Paging: https://developers.facebook.com/docs/graph-api/using-graph-api/#paging

If you are using Node.js on your server, you can also use async/await, like in this example: Asynchronous method in while loop with Graph API paged

andyrandy
  • 72,880
  • 8
  • 113
  • 130