Passing Arrays to the FB API

Ben edited this page Apr 21, 2017 · 6 revisions

Passing Arrays to FB

Some API endpoints require you to pass an array, for example the campaigns graph endpoint requires an array for the 'effective_status' parameter. See details here:

This means that Facebook is expecting an array literally in the url, not string with comma delimited items.

For raw requests (via Graph Explorer) this works:


This does not work:


^ produces an error: (#100) For field 'campaigns': param effective_status must be an array.

Using Koala

This can be passed to Koala by passing that array as a string literal so that the sanitizer will not change it:

@api.get_object('act_XXX', {fields:[:name, :id], effective_status: "[ACTIVE,PAUSED]"})

Hope this is helpful to someone, took me a bit to get through it. When in double check the raw requests agianst the graph explorer: Graph Explorer

You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.