2

My current requirement is to fetch all Facebook campaigns, adsets, ads, adcreatives and insights and store them locally on a json file.

My current approach is :

Im making a GET call to this endpoint with the appropriate access_token - https://graph.facebook.com/v11.0/ACT_ID/campaigns?fields=id,name,adsets{< fields required from adsets>},ads{< fields required from ads>,adcreatives{< fields required from creative>,insights{< fields required from ad insights>}}}&limit=999

The issue with this approach is, since I have quite a bit of fields that I'm trying to fetch, I get back an error saying

{
    "error": {
        "code": 1,
        "message": "Please reduce the amount of data you're asking for, then retry your request"
    }
}

which is fair.

After looking online, I found that the workaround for fetching large amount of data would be to use insights async call(Facebook API - reduce the amount of data you're asking for, then retry your request for 1 row).

But the issue with that is those calls work for a single ad object. There are thousands of ads, and making so many calls would simply end up with request limit reached error. (The whole point of embedding so many items in one endpoint as given above was to reduce the number of calls being made in order to prevent request rate limit)

If anyone knows how to implement the above endpoint asynchronously, that would solve all my problems with this approach.

Any other ways of implementing the requirements will also be appreciated.

Thank you, Your fellow developer

  • Retrying this a couple of times did the trick. Although this is not a solution, it works for my use case where retrying is an option. – Brijesh Patel Aug 18 '21 at 04:55

0 Answers0