Reputation: 2155
I'm trying to retrieve all Ad Campaign, Adsets and Ads from various accounts associated with our Business Manager.
The specific endpoints that I'm accessing are:
https://graph.facebook.com/v2.8/act_xxxxxxxxxxxxx/campaigns
https://graph.facebook.com/v2.8/act_xxxxxxxxxxxxx/adsets
https://graph.facebook.com/v2.8/act_xxxxxxxxxxxxx/ads
When I query some of these accounts for all Campaigns using the filter
parameter,
[{'operator': 'IN',
'field': 'ad.effective_status',
'value': [
'ACTIVE',
'PAUSED',
'DELETED',
'PENDING_REVIEW',
'DISAPPROVED',
'PREAPPROVED',
'PENDING_BILLING_INFO',
'CAMPAIGN_PAUSED',
'ARCHIVED',
'ADSET_PAUSED']}]
the Facebook API always returns this error:
{"error":{"code":1,"message":"Please reduce the amount of data you're asking for, then retry your request"}}
filter
parameter such as 1, 25, 50, 100, 500.date_preset
parameters (this seems irrelevant).{'operator': 'IN','field':'campaign.id','value':['xxxxxxxxxxxxx']}
as an additional filter in the filter
parameter./insights
endpoint, but I haven't had one work yet.When I only include ACTIVE
campaigns in the filter, the query works. This has allowed me to deduce that the DELETED
campaigns are the problem. In other words, these accounts have a ton of DELETED
campaigns.
I'm making my requests using Postman Version 5.0.0 (5.0.0).
I imagine if I can figure out how to get the Campaigns, the Adsets and Ads will be similar. How do I go about resolving this?
Upvotes: 2
Views: 5631
Reputation: 1096
The reason is that the API does not actually support querying for deleted objects for certain endpoints. I tried to obtain all campaigns for a certain account and this is the response.
Method: GET
Path:
https://graph.facebook.com/v2.10/act_XXXX/campaigns
Params: {'effective_status': '["ACTIVE","PAUSED","DELETED","ARCHIVED"]', 'fields': 'id,name,status', 'summary': 'true'}
Response:
{
"error": {
"code": 100,
"is_transient": false,
"error_subcode": 1815001,
"error_user_msg": "Requesting for deleted objects is not supported in this endpoint.",
"error_user_title": "Cannot Request for Deleted Objects",
"message": "Invalid parameter",
"type": "OAuthException",
"fbtrace_id": "FYDwMABcwxj"
}
}
After looking at the documentation I discovered this https://developers.facebook.com/docs/marketing-api/best-practices/storing_adobjects
And here they state
If you keep the deleted object id, you can continue to retrieve the stats or object details by individually querying the object ID. However you cannot retrieve the deleted objects as a connection object from a non deleted node/object.
Upvotes: 3