0

我試圖用python腳本查詢我的facebook廣告系列的費用。現在我認爲他們爲您生成示例代碼是好的,但即時得到這個錯誤:Facebook廣告API - 對象ID

Unsupported get request. Object with ID 'XXX' does not exist, cannot be loaded due to missing permissions, or does not support this operation. And i cant figure out what im doing wrong. For the access token im generating one on the Marketing API Configuration.

任何想法,我跳過或做錯了什麼?

該應用程序中添加了廣告帳戶同時從應用程序配置和業務配置: App business

這裏我得到的訪問令牌: Access token

下面是示例代碼即時通訊使用:

from facebookads.adobjects.adaccount import AdAccount 
from facebookads.adobjects.adsinsights import AdsInsights 
from facebookads.api import FacebookAdsApi 

access_token = 'xxx' 
ad_account_id = 'xxx' 
app_secret = 'xxx' 
FacebookAdsApi.init(access_token=access_token) 

fields = [ 
    'today_spend', 
] 
params = { 
    'time_range': {'since':'2017-07-03','until':'2017-08-02'}, 
    'filtering': [], 
    'level': 'campaign', 
    'breakdowns': [], 
} 
print AdAccount(ad_account_id).get_insights(
    fields=fields, 
    params=params, 
) 

回答

0

T他的解決方案非常愚蠢,我在ad_account_id號碼之前缺少'act_'。