facebook / facebook-php-business-sdk

PHP SDK for Meta Marketing API
https://developers.facebook.com/docs/business-sdk
Other
818 stars 514 forks source link

An unknown error has occurred #459

Closed LiuJun2333 closed 5 years ago

LiuJun2333 commented 5 years ago

when I use batch api create ads ,the SDK said : An unknown error has occurred when I create creatives code:

   $ad['adset_id'] = 'SetId';
    $ad['status'] =  'ACTIVE';
    $ad['name']   = 'API Test';

    $baseInfo = [
        'body' =>  'this is message',
        'caption' =>  'https://facebook.com/',
        'description' => 'this is description',
        'link' => 'https://facebook.com/',
        'name'=> 'whatever name',
        'image_hash'=>'0c3244937f9660b440fd32e4c8ba9fc9'
    ];
    $object_story_spec['link_data'] =  $baseInfo;
    $object_story_spec['page_id'] = 'xxxx';
    $creative['object_story_spec']  = $object_story_spec;
    $ad['creative'] = json_encode($creative);

    $adbatch = [
        [
            'name'      =>'create-ads',
            "relative_url" => "act_12345/ads",
            "body"  =>http_build_query($ad)
        ], 
        [
            'name'      =>'sec-ads',
            "relative_url" => "act_12345/ads",
            "body"  =>http_build_query($ad)
        ]
    ];

    $params = ['adbatch'=> $adbatch,'name'=>'test batch'];
    $adAccount = new AdAccount('act_12345');
   try{
          $batch  = $adAccount->createAsyncBatchRequest($fields,$params);
    }catch(){
       ....
   } 
vicdus commented 5 years ago

Hey, thanks for your comment! This is actually an api issue. Please report the issue on Devsite Bug Report channel: https://developers.facebook.com/support/bugs/ Thanks!