Search code examples
facebookfacebook-graph-apifacebook-php-sdkfacebook-marketing-api

Filter facebook graph results by any given field


I was wondering if it's possible to somehow filter graph results by any given field.

For example (Marketing API request through the graph API)

/{adaccount_id}/users?user={given user id}

Today i have to fetch all users and then in my code i have to filter out all other users that don't match. This makes it (counting as a data structure guy) very inefficient since in many requests i have to do huge breakdowns, which costs a lot of resources (some of them up to and over O(N^3)).

Any given help would be appreciated


Solution

  • I was wondering if it's possible to somehow filter graph results by any given field.

    No.

    Some endpoints have specific extra parameters for filtering – but there’s only a few. But you can not filter by just any arbitrary fields.

    This makes it (counting as a data structure guy) very inefficient

    From discussions I had about this with Facebook developers, they say it would affect overall API performance badly – so they rather let apps do any advanced filtering on their end.