Search code examples
facebookfacebook-graph-apifacebook-fqlfacebook-ads-apifacebook-marketing-api

Cannot retrieve the reach estimate for some Facebook ads (from the API)


The API lacks some clear explanations on retrieving the reachestimate for either an ad account or an ad. I have made sure that:

  • I am an admin/ or added to a Facebook app
  • I have a paid advertising campaign
  • The adaccount ID is added in the Settings Advanced panel of the Developer App page

I've been trying to:

  1. In Graph API Explorer, retrieve the data by query expansion: me?fields=adaccounts{campaigns{adsets{ads{reachestimate}}}}. However, I always get one of the following (randomly): Error 1 Error 2 Error 3

  2. Still in the explorer, retrieve it by direct access: act_{adaccount_id}/reachestimate I get this, even if I am 100% sure the ad account is added in the Advanced Settings panel: Error 4

  3. Both of 1 and 2 in the iOS project. I get this: com.facebook.sdk.core error 8

  4. Test it by curl with the example from here. I get this (the same with the one from point 2): The ad account is not enabled for usage in Ads API.

Just as a further note, for point 1 that's not the whole query, but I didn't write the adjacent fields because they would've been redundant for the purpose of this question.

I simply need to retrieve the ad accounts, the campaigns, the ad sets and the reach estimate simultaneously in the same query. It seems like a dead spot for me. Do you have any suggestions? Can you show me a Graph API explorer working example? Or, if what I'm asking is impossible, can you simply show some code that works?


Solution

  • Apparently, I got:

    Please reduce the amount of data you're asking for, then retry your request.
    

    Because the query was to broad. Those 'adjacent' fields actually triggered a massive query, so the solution was to either:

    1. Put a limit(1) on the campaigns.
    2. Individually retrieve the reachestimate for each adset.

    I chose the latter because it suited my needs, but it's up to you which solution works better.