facebook异步批处理作业不起作用?

时间:2018-11-26 04:18:43

标签: python facebook-graph-api

我们正在尝试按照批处理API(https://developers.facebook.com/docs/marketing-api/asyncrequests#batchapioverview)中提供的说明,在单个异步批处理作业中实施异步批处理作业,以创建广告系列的所有组件-广告系列,广告集,广告素材和广告。前两个广告系列和广告集可以正常使用,但是创建广告素材会导致错误-

“错误”:{“消息”:“无效参数”,“类型”:“ OAuthException”,“代码”:100,“错误子代码”:1815379,“ is_transient”:false,“ error_user_title”:“ relative_url”字段无效”,“ error_user_msg”:“请求集中提供的相对网址无效。”,“ fbtrace_id”:“ GJUf2CMCmpr”}}

请参阅下面正在执行创建广告素材的python代码部分。谢谢你的帮助。

create_creative_json = {'name': 'create-creative','relative_url': 'your_account_id/adcreatives'}

create_creative_body = "name=fb_1200_628_04.png&object_story_spec={'page_id':'<page_id>','link_data':{'link':'https://www.test123.com/'}}"

create_creative_encode = urllib.parse.quote(create_creative_body)

create_creative_json['body'] = create_creative_encode



fb_input = {

    'access_token': (None, fb_token),

    'name': (None, 'batchapiexample'),

    'test1': (None, '@./fb_1200_628_04.png'),

    'adbatch': (None, str([create_campaign_json,create_adset_json,create_creative_json]))

                }




response = requests.post('https://graph.facebook.com/v3.0/your_account_id/async_batch_requests', files=fb_input)

0 个答案:

没有答案