doutuoji8418 2016-06-13 08:57
浏览 68

从Facebook页面API获取Instagram帐户

I have created a sign in with facebook on my website and I am using facebook API and trying to find and get if the logged in user has an instagram account added to it's facebook page.

So I have a facebook page and i have added my instagram account to my page. Now when i run the following code:

$request = new FacebookRequest(
  $session,
  'GET',
  '/{page-id}/instagram_accounts'
);
$response = $request->execute();
$graphObject = $response->getGraphObject();

I get the following response:

Facebook\GraphObject Object
(
    [backingData:protected] => Array
        (
            [data] => Array
                (
                    [0] => stdClass Object
                        (
                            [id] => 1404189222940042
                        )
                )
            [paging] => stdClass Object
                (
                    [cursors] => stdClass Object
                        (
                            [before] => MTQwNDE4OTIyMjk0MDA0MgZDZD
                            [after] => MTQwNDE4OTIyMjk0MDA0MgZDZD
                        )
                )
        )
)

Now i'm unable to identify what is returned in the [data] that is '1404189222940042'. It's not my facebook ID, it's not my page ID, It's not my Instagram ID. What is this numeric data? Facebook says it's "A list of InstagramUser nodes" in the following link:

https://developers.facebook.com/docs/graph-api/reference/page/instagram_accounts/

So my question is: 1) What is this InstagramUser node? 2) How can I get the instagram account of the facebook page.

  • 写回答

1条回答 默认 最新

  • douji5523 2016-10-03 11:31
    关注

    1) What is this InstagramUser node?

    It's the instagram user ID in Facebook graph. You can access it using the instagram user endpoint described here:

    https://developers.facebook.com/docs/graph-api/reference/instagram-user/

    2) How can I get the instagram account of the facebook page.

    Using the instagram user API endpoint referenced above, you can read the username field corresponding the the instagram user.

    评论

报告相同问题?