dsdtszi0520538 2017-11-25 22:30 采纳率: 100%
浏览 23

领导形式营销APi Facebook创建错误

I'm reproducing exactly the same simple example for lead form creation on facebook (https://developers.facebook.com/docs/marketing-api/guides/lead-ads/create)

I'm using the API SDK PHP and after running $form.create(); i'm recibing this error..

Fatal error: Uncaught FacebookAds\Http\Exception\AuthorizationException: (#100) The parameter questions[0][type] is required in C:\inetpub\wwwroot\leads\vendor\facebook\php-ads-sdk\src\FacebookAds\Http\Exception\RequestException.php:

This is the function code.

function create_form($page_id,$form_name,$url_follow,$idlegal,$idcontext){
  $form = new LeadgenForm(null, $page_id);
  $form->setData(array(
  LeadgenFormFields::NAME => $form_name,
  LeadgenFormFields::FOLLOW_UP_ACTION_URL => $url_follow,
  LeadgenFormFields::QUESTIONS => array(
      (new LeadGenQuestion())->setData(array(
         LeadgenQuestionFields::TYPE => 'EMAIL',
         )),
      ),
  'context_card_id' => $idcontext,
  'legal_content_id' => $idlegal,
));
$form->create();
}

$idcontext $idlegal are recently created with succesfully code.

Any Idea? thanks in advance!

I debuged until api:call and dumped this $data (befor call)

Array ( [name] => AGENT-TIME_STAMP-Title [follow_up_action_url] => https://www.site.es/ [questions] => Array ( [0] => FacebookAds\Object\LeadGenQuestion Object ( [data:protected] => Array ( [key] => [label] => [options] => [type] => EMAIL ) [_type_checker:protected] => FacebookAds\TypeChecker Object ( [type_data:FacebookAds\TypeChecker:private] => Array ( [key] => string [label] => string [options] => list [type] => string ) [enum_data:FacebookAds\TypeChecker:private] => Array ( ) [primitive_types:FacebookAds\TypeChecker:private] => Array ( [0] => unsigned int [1] => int [2] => bool [3] => string [4] => Object [5] => datetime [6] => float ) ) ) ) [context_card_id] => 1120914681377165 [legal_content_id] => 1166716330131814 )

  • 写回答

2条回答 默认 最新

  • doumo3903 2017-11-25 22:35
    关注

    instead of LeadgenQuestionFields::TYPE => 'EMAIL'

    try this 'type' => 'EMAIL'

    评论

报告相同问题?

悬赏问题

  • ¥20 我要一个分身加定位两个功能的安卓app
  • ¥15 基于FOC驱动器,如何实现卡丁车下坡无阻力的遛坡的效果
  • ¥15 IAR程序莫名变量多重定义
  • ¥15 (标签-UDP|关键词-client)
  • ¥15 关于库卡officelite无法与虚拟机通讯的问题
  • ¥15 目标检测项目无法读取视频
  • ¥15 GEO datasets中基因芯片数据仅仅提供了normalized signal如何进行差异分析
  • ¥100 求采集电商背景音乐的方法
  • ¥15 数学建模竞赛求指导帮助
  • ¥15 STM32控制MAX7219问题求解答