我们正在尝试实施异步批处理作业,以便按照批处理API(https://developers.facebook.com/docs/marketing-api/asyncrequests#batchapioverview)中提供的说明在单个异步批处理作业中创建广告系列的所有组成部分 - 广告系列,广告集,广告素材和广告 . 虽然前两个广告系列和广告都没有任何问题,但创建广告素材会导致错误 -

“错误”:{“message”:“无效参数”,“类型”:“OAuthException”,“code”:100,“error_subcode”:1815379,“is_transient”:false,“error_user_title”:“relative_url字段无效”, “error_user_msg”:“请求集中提供的relative_url无效 . ”,“fbtrace_id”:“GJUf2CMCmpr”}}

请参阅下面执行create creative的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)