Facebook Api search users by name returning empty data - facebook

I used this url with access token https://graph.facebook.com/search?q=Marcus&type=user&access_token= and it returns empty data data []
Settings https://i.imgur.com/6hEiO5y.png
I was trying to get a list of users with their name using javascript. Is it possible ?

as mentioned in the comments here is the official Facebook note, that you cannot search for type = user anymore:
https://developers.facebook.com/docs/graph-api/changelog/breaking-changes#search-4-4

The /search endpoint for pages, videos, groups and events has been disabled by facebook after the cambridge analytica scandal.
Faceboook Changelog:
You can no longer use the /search endpoint with the following object types:
event
group
page
user

Related

Facebook graph API {post-id}/likes returns empty data

This request returns an empty array: graph.facebook.com/773227196065108/likes, but this request returns a normal array: graph.facebook.com/576234822476425/likes.
First post - post from user, second post - post from page.
How do I get a normal result in the first case?
http://graph.facebook.com/773227196065108 returns
{
error: {
message: "An access token is required to request this resource.",
type: "OAuthException",
code: 104
}
}
since its a user post and probably not public, you will have to access it using a proper access token on behalf of the user . also the number of likes obtained via graph api is dependant on the the privacy settings of people who liked the post .
the second post is one from a page and is public, so its directly accessible for you .
773227196065108 is a user whereas 576234822476425 is a page. Public page posts can be inspected in the API, public user posts have certain restrictions applied to them such as, the queried user must be using the application as well. If the queried user isn't using the querying application the response will be empty.
In addition /me/likes/773227196065108 will not work as /me/likes are only for pages not posts.

How can I get user's facebook interests?

I am trying to get interest from Facebook Api but empty array is returned.
I have searched for other issues like:
How to get user Interests? (//stackoverflow.com/questions/12422714/how-to-get-user-interests)
How can I get the interests of my friend through facebook api?(//stackoverflow.com/questions/6587373/how-can-i-get-the-interests-of-my-friend-through-facebook-api)
In "Graph API Reference" (developers.facebook.com/docs/graph-api/reference/v2.1) is defined a full list of nodes. If I click in 'user' and click in 'interest' I am redirected to "/{user-id}/interests" (//developers.facebook.com/docs/graph-api/reference/v2.1/user/interests) description. In this description are defined serveral points:
Endpoint: GET /user/interests
Permission: user_interests
Descrption: The interests listed on someone's profile under "Likes > Interests" (//www.facebook.com/me/likes_interests).
I am using Graph API Explorer for to test. I have used all api versions (from unversioned to v2.1).
If I get a valid access token with aproppiated permission and I do a request to endpoint "/me" I have a successfully response with data.
If I do a request to endpoint "/me/interests" I have a empty response:
{
"data": [
]
}
My user in Facebook is following a list of interest for example: stackoverflow group.
If I do a request to movies or books the response are empty too. But if I do a "like action" in a book or movie and try again I have a successfull response. If I try again with "/me/interest" response is empty yet.
I believe that I do not understand concept of "interest" or something is wrong and I can not see it.
Which is the way for to recovery the interests of an user?
The interests are specified in the Profile section, and not via Like actions! The list you linked is not an interest either.
Books and Movies can be requested with the user_likes permission, so if you didn't request that the response will be empty as well.

Facebook API For Pulling Reviews

Has anyone seen a full example of how to pull facebook reviews using the graph api.
According to the docs:
A page access token is required to retrieve this data.
I have code that asks a user to login already and gets an auth token which I can use to post a message to their facebook feed. Is there an additional step I need to do to be able to read their reviews/ratings?
Here is an example of the code to post to their feed/page.
response = Curl.post("https://graph.facebook.com/#{page_id}/feed", {
:message => message,
:access_token => auth_token
})
Thanks
If you're referring to Page Ratings (different from App Reviews!), then the endpoint is
GET /{page_id}/ratings
as described here: https://developers.facebook.com/docs/graph-api/reference/page/ratings You'll need a Page Access Token for this.
Where I get a little bit confused is that you mention that you want to
read their reviews/ratings
In that case it's something else, because afaik it's currently not possible to query the User's Page ratings via Graph API or FQL. It's was only possible to query App Reviews via FQL (see https://developers.facebook.com/docs/reference/fql/review/) (Update: FQL is no longer available since 2016)
You need to set permission in the app to access the {GET /{page_id}/ratings} API. The permission is common for
/page/comments,
/page/posts,
/page/ratings,
/page/tagged,
and the permission name is "pages_read_user_content"
https://developers.facebook.com/docs/permissions/reference/pages_read_user_content

Facebook graph API returns false for existing and public event

There is a public Facebook event, for example: http://www.facebook.com/events/197276753679964/
I want to get information about this event using Facebook graph API.
I'm using this query url: http://graph.facebook.com/197276753679964
Facebook returns "false", but event is existing and public, so what's the problem?
There are a few more events with this annoying behaviour, but other ~95% I can read succesfully using FB graph API.
If the event is owned by a group or page which is restricted demographically, you can only access that even with the access token of a user who can see the event / page.
(this appears to be the case with the example in this question)
In general (one current bug excepted), 'false' means a privacy check failed

Retrieve Facebook users that like a URL / web page via Open Graph

Is there a way to retrieve the list of Facebook users that have clicked the like button on an external website?
E.g. there is a domain example.com which has been confirmed via Facebook Insights to belong to fbUser1 (using OG meta tags).
Somewhere on example.com there is a page with multiple XFBL like buttons, each one pointing to a further specific URL on example.com, e.g. example.com/xyz, example.com/abc etc.
What I'd like to get is the list of users that liked example.com/xyz and of those who liked example.com/abc.
My intuitive approach would be to look at graph.facebook.com/123456789/likes (where the number is the ID of the domain taken from FB insights), but this always returns an empty dataset:
{
"data": [
]
}
I've also tried getting an OAuth access token from https://graph.facebook.com/oauth/access_token?type=client_cred&client_id=APPID&client_secret=APPSECRET (where APPID and APPSECRET are taken from a FB application that is marked as owning the domain using OG meta tags), but that makes no difference.
I'd also be interested in a non-OpenGraph (i.e. JS SDK, FQL etc.) solution.
EDIT: Using the following code (according to WideBlade's answer below) still gives me an empty list of likes (the second query never returns):
var objectsQuery = "select id from object_url where url in ('http://example.com/xyz', 'http://example.com/abc', 'http://example.com/123')";
var likesQuery = "select object_id from like where object_id = {0}";
FB.Data.query(objectsQuery).wait(function (objectRows) {
console.log(objectRows);
FB.Array.forEach(objectRows, function (objectRow) {
FB.Data.query(likesQuery, objectRow.object_id).wait(function (likeRows) {
console.log(likeRows);
})
});
});
FQL Should do the trick.
$facebook->api_client->fql_query('SELECT user_id FROM like WHERE object_id="OBJECTID"');
Here is the link.
Some general info about FQL.
FQL is initiated using the JavaScript SDK, in this way.
If you can post some sample code-I can try and give some more specific help.
A note should be made-once you've got the user ID's, you can just query the names and get them in a list.
EDIT: To get the URL of an object you should query this table using fql.
This cannot be done. Facebook does not allow you to query for specific user ID's of people who have liked a certain page. This is because of privacy concerns.
See the disclaimer on this page https://developers.facebook.com/docs/reference/fql/like/