0

In the Graph API Explorer tool I'm using this query:

search?q=myemail@gmail.com&type=user

But for whatever reasons I'm getting this returned.

{
  "error": {
    "message": "(#200) Must have a valid access_token to access this endpoint", 
    "type": "OAuthException", 
    "code": 200
  }
}

The access token is there. And other requests work, like this one:

me?fields=id,name

Here's the return value

{
  "id": "somelongnumber", 
  "name": "my name"
}

Not sure what I'm doing wrong, are there additional permissions that I have to setup to get search to work?


Edit: Here's the screenshot of my user permissions:

enter image description here

enter image description here

I have also tried using an application token, but same thing.


More updates:

Querying for names seem to work just fine:

search?q=FirstName LastName&type=user 

returns valid results, but email returns me oath exception. Did facebook change the way they allow for email searches?

Stéphane Bruckert
  • 21,706
  • 14
  • 92
  • 130
Stupid.Fat.Cat
  • 10,755
  • 23
  • 83
  • 144
  • Some reading https://developers.facebook.com/docs/facebook-login/access-tokens – Stéphane Bruckert Dec 16 '14 at 19:59
  • @StephaneBruckert Eh.. I'm pretty sure I have a user access token set up. Not sure what in particular I'm supposed to be reading? – Stupid.Fat.Cat Dec 16 '14 at 20:16
  • Ok then your access token is not valid because you don't have the right permissions. Either read about [permissions](https://developers.facebook.com/docs/facebook-login/permissions/v2.2) or "facebook permissions", this has also been posted plenty of times on SO. – Stéphane Bruckert Dec 16 '14 at 21:01
  • @StephaneBruckert just to be safe I checked on every single User permission, so that doesn't seem to be the case. – Stupid.Fat.Cat Dec 16 '14 at 21:05
  • @StephaneBruckert edited my question to include a couple of screenshots for the user permissions. – Stupid.Fat.Cat Dec 16 '14 at 21:10
  • possible duplicate of [Facebook Search API with email address not working?](http://stackoverflow.com/questions/19746530/facebook-search-api-with-email-address-not-working) – Stéphane Bruckert Dec 16 '14 at 21:52
  • Sorry if I didn't get straight to the point in my comments, I read your thread a bit too quickly. We get these `Must have a valid access_token` problem a bit too often. – Stéphane Bruckert Dec 16 '14 at 22:07

1 Answers1

0

Even though it was possible, you can't search users by their e-mail addresses anymore. As the doc states, the q value must refer to the name of a user.

Available Search Types

  • Type: user
  • Description: search for a person (if they allow their name to be searched for)
  • q value: name

Also the dot character which is/are present in every e-mail address would also break your Graph request. In the current Graph API syntax, . marks the beginning of a subfield, for instance:

/me?fields=friends.limit(10)
                  ^

How would the email be delimited? As you can see,

/search?q=john@gmail&type=user "works"

whereas

/search?q=john@gmail.com&type=user doesn't.


Edit: This feature has been disabled in April 2013 and Facebook reported:

This functionality was deprecated because of low utilization, and we have no current plans to re-enable it. If you have a valid use case for this feature please describe it here for consideration. Marie Hagman — Facebook Team

Source: https://developers.facebook.com/x/bugs/453298034751100/

Community
  • 1
  • 1
Stéphane Bruckert
  • 21,706
  • 14
  • 92
  • 130
  • Some searching around the net seem to indicate that email is/was supported at some point. Was it removed completely? Not to mention that you can search through the facebook search as well... – Stupid.Fat.Cat Dec 17 '14 at 00:28
  • Look at my edit. Also know that not all features have to exist in the API. It's like "can you see a list of all your friends on Facebook?" yes! "can you see a list of all your friends on the Graph API explorer? [no](http://stackoverflow.com/questions/27484893/fetch-facebook-friends-list-of-logged-user/27484960)! – Stéphane Bruckert Dec 17 '14 at 01:02