facebook getting user id from graph api via taggable_friends

In v1.0 API I was able to get friends with their facebook ID like this:

{
      "name": "Somename SomeSurname", 
      "id": "100007797060798"
 }

In the v2.0 I can use only taggable_friends to get this information, however `i must have missed something in the documentation, because the id I'm getting is like this (id is always different):

{
      "id": "AaKJ-QN8OlY3m-2DHeVnc5oQZFnx_V0ptUF8XFEstr3EcS1LltvAx0_xptve3DWc_vI1zP0s4RhVMOTk1EqDvzCHMkEqFRMIkuXtyXe5d9O1-Q", 
      "name": "Somename someSurname"
}

can someone point me where I can retrieve a real ID out of this?

Answers


There is no way to get to id via taggable_friends endpoint.

https://developers.facebook.com/docs/apps/upgrading


/me/taggable_friends shows all friends in the list except for some. In one case, there are 326 friends in a profile but this only shows 317 and in another profile there are 194 friends in total but it only shows 182.

$flist = $fb->api('/me/taggable_friends?fields=name,id&limit=1000');

shows almost all friends in the list (despite the limit being too high) but leaves some of them in both cases. This might not work on the api explorer if your app is not approved and published but it will work for admins, testers and developers of your application.

You cannot decode this id because that would defeat the purpose of encoding it in the first place.

What I am also wondering is that whether it is possible to invite friends of a user to use the application?


may be you can get id by search people with the same picture.

me?fields=taggable_friends{name,picture}

{
        "name": "ปาณิศา หลานตากอย.ตาแก้ว คงเพ็ชร",
        "picture": {
          "data": {
            "url": "https://fb-s-c-a.akamaihd.net/h-ak-fbx/v/t1.0-1/p100x100/19113605_1931156107168776_605762913793659652_n.jpg?oh=951c7c13a85b0ce3abe8a6e7bacae127&oe=59DA354A&__gda__=1508078042_6baaa5dc05f7b1e85f7a90e8c21e517b"
          }
        },
        "last_name": "คงเพ็ชร",
        "first_name": "ปาณิศา",
        "id": "AaKW3BwqCsT_4IspPO5jlFZet-4LnXQfulxsumuI-4Mel7M-0cTX-7gbARaOJSy7JMbLDBcwCEMdBvJQmZ7-YNEN-o_EDpugQfY02UqjED_uvQ"
      }

then

search?type=user&q=ปาณิศา หลานตากอย.ตาแก้ว คงเพ็ชร&fields=id,name,picture


"data": [
{
  "id": "1519971271620597",
  "name": "ปาณิศา หลานตากอย.ตาแก้ว คงเพ็ชร",
  "picture": {
    "data": {
      "is_silhouette": false,
      "url": "https://fb-s-c-a.akamaihd.net/h-ak-fbx/v/t1.0-1/p50x50/19113605_1931156107168776_605762913793659652_n.jpg?oh=21c44649424500928d0299291414f1aa&oe=59A27344&__gda__=1508317043_a83bb236c462cd9d179f8e949cea801f"
    }
  }
}

]

the two results have same url filename 19113605_1931156107168776_605762913793659652_n.jpg then you can get id from search result 1519971271620597


or use link: https://graph.facebook.com/v2.0/me?fields=about it return facebook Id and you can insert into your DB.


You need to request for "user_friends" permission while creating access token for that user.

After that you can make a call to graph API:

https://graph.facebook.com/v2.0/me?fields=friends

and it will return the results in following format:

{
  "friends": {
    "data": [
      {
        "name": "Dummy1",
        "id": "454####455"
      },
      {
        "name": "Dummy2",
        "id": "82####374"
      },
      {
        "name": "Dummy3",
        "id": "10###7277"
      },

    ]
  },
  "id": "14###1568"
} 

Need Your Help

What do "module.exports" and "exports.methods" mean in NodeJS / Express?

javascript node.js express module export

Looking at a random source file of the express framework for NodeJS, there are two lines of the code that I do not understand (these lines of code are typical of almost all NodeJS files).

How do iOS Push Notifications work?

ios push-notification apple-push-notifications

How do iOS "push" notifications get delivered to a particular device without that device needing to poll a server?