I hope, someone has stumbled over the same issue and might guide me towards a simple solution for my problem.
I want to retrieve regularly some data regarding my Ads on Facebook. Basically, I just want to store some metadata in one of my databases for further reporting purposes. Thus, I want to get AD-ID, AD-name and corresponding ADSET-ID for all my Ads.
I have written this small function in Python:
def get_ad_stats(ad_account):
""" Pull basic stats for all ads
Args: 'ad_account' is the Facebook AdAccount object
Returns: 'fb_ads', a list with basic values
"""
fb_ads = []
fb_fields = [
Ad.Field.id,
Ad.Field.name,
Ad.Field.adset_id,
Ad.Field.created_time,
]
fb_params = {
'date_preset': 'last_14_days',
}
for ad in ad_account.get_ads(fields = fb_fields, params = fb_params):
fb_ads.append({
'id': ad[Ad.Field.id],
'name': ad[Ad.Field.name],
'adset_id': ad[Ad.Field.adset_id],
'created_time': datetime.datetime.strptime(ad[Ad.Field.created_time], "%Y-%m-%dT%H:%M:%S+0000"),
})
return (fb_ads)
Similar functions for Campaign- and AdSet-data work fine. But for Ads I am always reaching a user request limit: "(#17) User request limit reached".
I do have an API-access level of "BASIC" and we're talking here about 12,000 Ads. And, unfortunately, async-calls seem to work only for the Insights-edge.
Is there a way to avoid the user request limit, e.g. by limiting the API-request to only those Ads which have been changed/newly created after a specific date or so?