Facebook 广告 API - 具有 ID 的对象
Facebook Ads API - Object with ID
我正在尝试使用 python 脚本查询我的 Facebook 广告系列的费用。现在我认为他们为您生成的示例代码没问题,但我收到此错误:
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.
知道我跳过了什么或做错了什么吗?
该应用已从应用配置和业务配置中添加了广告帐户:
在这里我得到了访问令牌:
这是我使用的示例代码:
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,
)
解决方案真的很愚蠢,我在 ad_account_id 数字之前缺少 'act_'。
我正在尝试使用 python 脚本查询我的 Facebook 广告系列的费用。现在我认为他们为您生成的示例代码没问题,但我收到此错误:
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.
知道我跳过了什么或做错了什么吗?
该应用已从应用配置和业务配置中添加了广告帐户:
在这里我得到了访问令牌:
这是我使用的示例代码:
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,
)
解决方案真的很愚蠢,我在 ad_account_id 数字之前缺少 'act_'。