I am trying to create ad account in Facebook business manager via Facebook marketing and graph API using following code.
$attachment = array('access_token' => $this->accessToken,
'name' => $associative_arr['name'],
'currency' => $associative_arr['currency'],
'timezone_id' => $associative_arr['timezone_id'],
'end_advertiser' => $this->mybusinessId,
'media_agency' => 'NONE',
'partner' => 'NONE',
'access_type' => 'OWNER',
'permitted_roles' => 'ADMIN'
//'user_role' => '1001'
);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,'https://graph.facebook.com/'.$this->apiVersion.'/'.$this->mybusinessId.'/adaccount');
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $attachment);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); //to suppress the curl output
$result = curl_exec($ch);
$dcde = json_decode($result);
curl_close ($ch);
It successfully creates ad account but does not add me as a user in people with administrative access.
Can anyone give me suggestion what can be the reason?