Q:

Facebook Marketing API get campaign info

I'm using the code autogenerated by facebook to try and connect to the marketing API to get campaign stats. In doing so, I'm getting:

Uncaught FacebookAds\Http\Exception\AuthorizationException: (#100) results, actions:like, video_play_actions:video_view, video_avg_time_watched_actions:video_view, unique_actions:link_click are not valid for fields param.

$fields = array(
  'results',
  'reach',
  'actions:like',
  'video_play_actions:video_view',
  'video_avg_time_watched_actions:video_view',
  'unique_actions:link_click',
);
var_dump($fields);
$params = array(
  'level' => 'campaign',               
  'filtering' => array(array('field' => 'campaign.delivery_info','operator' => 'IN','value' => array('active'))),
  'breakdowns' => array(),
  'time_range' => array('since' => '2017-05-19','until' => '2019-05-19'),
);
echo json_encode((new AdAccount($ad_account_id))->getInsights(
  $fields,
  $params
)->getResponse()->getContent(), JSON_PRETTY_PRINT);

Above I used campaign.delivery_info per this answer. I've also tried (per the auto-generated code):
'filtering' => array(array('field' => 'delivery_info','operator' => 'IN','value' => array('active')))

A:

Seems you are asking for old values field, try this:
$fields = array(
  'reach',
  'actions',
  'video_play_actions',
  'video_avg_time_watched_actions',
  'outbound_clicks',
);

Hope this help
NB: results field is not available

