I am using php code for fb marketing api and facing this deprecation issue
Deprecated: read is being deprecated, please try not to use this in new code.
use FacebookAds\Object\AdAccount;
use FacebookAds\Object\Fields\AdAccountFields;
$account = new AdAccount('act_<AD_ACCOUNT_ID>');
$account->read(array(
AdAccountFields::TOS_ACCEPTED,
));
// Dump TOS Accepted info.
var_dump($account->{AdAccountFields::TOS_ACCEPTED});
Have they updated their code somewhere else? what should I use instead of read
function? Thanks.
The API successfully return the field about TOS, probably a deprecation of the SDK Library, try this (I take it from an example in the repo):
use FacebookAds\Object\AdAccount;
use FacebookAds\Api;
use FacebookAds\Logger\CurlLogger;
$access_token = '<ACCESS_TOKEN>';
$app_secret = '<APP_SECRET>';
$app_id = '<APP_ID>';
$id = '<AD_ACCOUNT_ID>';
$api = Api::init($app_id, $app_secret, $access_token);
$api->setLogger(new CurlLogger());
$fields = array(
'name',
'tos_accepted',
);
$params = array(
);
echo json_encode((new AdAccount($id))->getSelf(
$fields,
$params
)->exportAllData(), JSON_PRETTY_PRINT);