Reputation: 61
I'm new on Facebook marketing API.
1) they let me open only a sandbox account and I want to create a real one and get a real report.
2) after generating the example code and working with Python SDK and getting this error - Unsupported get request. Object with ID '[number_of_ad_account_id]' does not exist, cannot be loaded due to missing permissions, or does not support this operation. Please read the Graph API documentation at https://developers.facebook.com/docs/graph-api
please help me solve this issues. thanks.
EDIT: CODE (take from Facebook sample code)
from facebookads.adobjects.adaccount import AdAccount
from facebookads.adobjects.adsinsights import AdsInsights
from facebookads.api import FacebookAdsApi
access_token = '{secret}'
ad_account_id = '{secret}'
app_secret = '{secret}'
FacebookAdsApi.init(access_token=access_token)
fields = [
'account_id',
'adgroup_id',
'campaign_group_id',
'campaign_id',
]
params = {
'time_range': {'since':'2017-07-10','until':'2017-07-10'},
'filtering': [],
'level': 'account',
'breakdowns': [],
}
print AdAccount(ad_account_id).get_insights(
fields=fields,
params=params,
)
Upvotes: 2
Views: 1339
Reputation: 630
I had the same problem. The SAMPLE_CODE.py auto-generated from Marketing API's quickstart doesn't prefix ad_account_id
with act_ by default; it puts the Sandbox Account ID directly, while the Ad Insights API expects:
act_<AD_ACCOUNT_ID>/insights
Just prefix you ad_account_id
with act_
and it will work.
Upvotes: 5