php - Fb Ads api How to get Active only FB Campaigns? -


i trying campaigns list facebook ads api using below code

        $account = new adaccount('act_' . $account_id);         $campaignsets = $account->getcampaigns(array(             campaignfields::id,             campaignfields::name,             campaignfields::start_time,             campaignfields::stop_time,             campaignfields::spend_cap,             'effective_status'                 )); 

but need active campaigns list how can filter list camapign status = active only

thanks, ronak shah

if check method declaration adaccount->getcampaigns, see accepts 2 parameters $fields , $params. $fields fields want retrieve, , $params filter. example in case (tested v2.5):-

$account = new adaccount('act_' . $account_id);  $fields = array(     campaignfields::id,     campaignfields::name,     campaignfields::start_time,     campaignfields::stop_time,     campaignfields::spend_cap,     'effective_status' );  $params = array(     'effective_status' => array(         campaign::status_active     ), );  $campaignsets = $account->getcampaigns($fields, $params); 

hope helps! :)


Comments

Popular posts from this blog

sublimetext3 - what keyboard shortcut is to comment/uncomment for this script tag in sublime -

java - No use of nillable="0" in SOAP Webservice -

ubuntu - Laravel 5.2 quickstart guide gives Not Found Error -