Sjoerd Perfors
Sjoerd Perfors

Reputation: 2317

Can't get Facebook user id by Graph

I'm working on an iOS app and noticed that one user is not loaded when I do a requestForMyFriends.

After looking more into this it seems that the Graph API explorer also doesn't return anything for the particular Facebook user. It's a user and not a Fanpage or something.

So:

I've the page for example (which when I enter In my browser will bring up the Page nicely): https://www.facebook.com/user-name

https://graph.facebook.com/https://www.facebook.com/user-name

Will return:

{
    id: "https://www.facebook.com/user-name"
}

https://graph.facebook.com/user-name

Will return:

{
    error: {
        message: "Unsupported get request.",
        type: "GraphMethodException",
        code: 100
    }
}

http://findmyfacebookid.com/ wil return nothing.

The graph API will return:

{
  "error": {
    "message": "Unsupported get request.", 
    "type": "GraphMethodException", 
    "code": 100
  }
}

I'm trying to reproduce this with my test Facebook account and put all restrictions to the max but I always get a nice result with a FacebookId.

My question: What settings do I need to change to my test Facebook account to reproduce this problem?

Upvotes: 0

Views: 2533

Answers (2)

Igy
Igy

Reputation: 43816

"Unsupported GET Request" covers many situations, but at the root the message means you tried to request something via the API which is not available to you via the API

For a request which attempts to retrieve data about a known username or user ID the most likely reasons are:

  • User has blocked your app
  • User has disabled all platform apps in their privacy settings
  • User has deactivated their account
  • User has deleted their account

if i had to bet, I'd say it's the second one in this case

Upvotes: 2

Björn Kaiser
Björn Kaiser

Reputation: 9912

The problem is the parameter, you don't have to pass in the whole URL of a profile, just the username/profile-id.

For example: we want to get the info of Mark Zuckerberg. His Facebook username is zuck. The URL would be https://graph.facebook.com/zuck and will return the following output

{
   "id": "4",
   "name": "Mark Zuckerberg",
   "first_name": "Mark",
   "last_name": "Zuckerberg",
   "link": "http://www.facebook.com/zuck",
   "username": "zuck",
   "gender": "male",
   "locale": "en_US"
}

Using https://graph.facebook.com/4 (4 is the profile id of Mark Zuckerberg) would produce the same output.

Edit
After some further investigation it turned out that said user might have deactivated her account and that is why you see this error. I have used a testuser of one of my apps, went to Settings -> Security -> Deactivate my account and taxa, every request to the Graph API returned the result you're seeing.

Upvotes: 0

Related Questions