My function to list add_group_account id of a particular user ends up by receiving the following error.
Message: Unknown path components: /adaccountgroups
I'm following this guideline Facebook API documentation
public function tp()
{
$fb = new Facebook([
'app_id' => "621201298943758",
'app_secret' => "f0aa4ae743ef.................",
'default_graph_version' => 'v2.5',
'default_access_token' => "EAAI0ZBrLB7w4BAIUyoGjSB50ZBsXbPxYfCjk6WxPQIa.................................",
]);
try {
// Returns a `Facebook\FacebookResponse` object
$response = $fb->get(
'/me/adaccountgroups',
'EAAI0ZBrLB7w4BAIUyoGjSB50ZBs.....................'
);
} catch(Facebook\Exceptions\FacebookResponseException $e) {
echo 'Graph returned an error: ' . $e->getMessage();
exit;
} catch(Facebook\Exceptions\FacebookSDKException $e) {
echo 'Facebook SDK returned an error: ' . $e->getMessage();
exit;
}
$graphNode = $response->getGraphNode();
}
CodePudding user response:
As I have discovered there is no endpoint or function by the name "adaccountgroups"available even though it was mentioned in their own documentation.
To get the add account ID corresponding to a particular user account it has to be called in following pattern
curl
https://graph.facebook.com/v13.0/me/adaccounts?access_token=EAAI0ZBrLB7w...............
SDK
$response = $fb->get(
'/me/adaccounts',
'{token.....}'
);