Php-graph-sdk: Unable to convert response from Graph to a GraphEdge because the response does not look like a GraphEdge

Created on 12 May 2017  路  3Comments  路  Source: facebookarchive/php-graph-sdk

Using the lastest API Graph I'm getting this error:
Unable to convert response from Graph to a GraphEdge because the response does not look like a GraphEdge. Try using GraphNodeFactory::makeGraphNode() instead.
I need the GraphEdge in order to use the pagination methods.

This works fine:
$fb = app(SammyK\LaravelFacebookSdk\LaravelFacebookSdk::class);
$response = $fb->get('/'.$page.'/feed?limit=100', $token);
$posts = $response->getGraphEdge();

Whit this request I'm getting the error:
$fb = app(SammyK\LaravelFacebookSdk\LaravelFacebookSdk::class);
$response = $fb->get('/'.$page.'/?fields=posts{id,story,message,likes.limit(0).summary(true),comments.limit(0).summary(true), shares}&limit=100', $token);
$posts = $response->getGraphEdge();

Any ideas?
Thanks in advance!

Most helpful comment

Cause "/feed" is an Edge of Node $page
But when you ask only $page?fields=....... You ask for a Node.

Try with a getGraphNode()

(Edge contains a list of Node)

All 3 comments

Cause "/feed" is an Edge of Node $page
But when you ask only $page?fields=....... You ask for a Node.

Try with a getGraphNode()

(Edge contains a list of Node)

Thanks, @tolbon! You save my day!
It works!

Thanks for chiming in on this one @tolbon! :)

Was this page helpful?
0 / 5 - 0 ratings