StuBlackett
StuBlackett

Reputation: 3857

Unsupported get request - Facebook API

I am trying to get a Facebook Pages' feed through the Facebook API.

Putting one of my pages - koodoocreative into my code brings back the data no problem at all.

But when I've tried loading in one of our clients into the API, I get the message...

Unsupported get request

Attached is an image of the pages' permissions

Facebook Page Permissions

My PHP code is as follows....

// init app with app id (APPID) and secret (SECRET)
FacebookSession::setDefaultApplication('','');

$session = new FacebookSession('');

// First Get The Groups' Details...
$request = new FacebookRequest(
        $session,
        'GET',
        '/'.$app_view->app_view_title
);
$response = $request->execute();
$graphObject = $response->getGraphObject();

$page_name = $graphObject->getProperty('name');

// Next Get The Posts...
$request = new FacebookRequest(
        $session,
        'GET',
        '/'.$app_view->app_view_title.'/feed?limit=10'
);
$response = $request->execute();
$object = $response->getGraphObject();

$fbdata = $object->getPropertyAsArray('data');

?>

Upvotes: 0

Views: 314

Answers (1)

Niraj Shah
Niraj Shah

Reputation: 15457

The issue is that you're using username for the pages, e.g. /koodoocreative, whereas the client may not necessarily have this. You should use numerical Page IDs instead, this way, the API call will work for pages with and without vanity URLs.

Upvotes: 1

Related Questions