I want to search the user's list of likes, to know if he liked my page or not
https://graph.facebook.com/v2.10/me/likes
I also want to know I did not follow my profile or not
https://graph.facebook.com/v2.10/me/???
There is no way to check if someone follows your profile. For getting to know if a user likes your page, you would need to authorize that user with the user_likes permission.
To check if the user likes your page without going through the whole list, you can use the following API endpoint: /me/likes/[page-id] ... if it returns something, the user liked the Page.
Related
from my ios app after fb login, facebook returns me the userid.
i call https://graph.facebook.com/v2.8/me/likes/[pageid]?access_token=...
to check if the user likes my fb page. But i get empty array while the same user has liked my page from the web.
The user has different userId when logins directly to facebook website and different when logins in my app. While the user has liked my page from web , how can i see it in the api call from my app using the userid that fb returns me when he logins from my app?
Thank you very much
Please note that there is no direct way of checking whether a particular user has liked a certain page or not using FB Graph API.
But i believe there is a workaround for this and you can try to hit the below URL in your browser
https://www.facebook.com/search/<page_id>/likers?ref=about
It will return all the people information who have liked the page provided. I am not sure would this return all the results or just some of them. But i believe you can try this.
You can then do some web scraping which will help you indentify whether 'person A' has liked a page say 'abc'.
Now you can hit the below endpoint to retreive all the likes this 'person a' has liked
FB.api('/person_id_obtained_from_above/likes')
But please note that you need user_likes permission to retrieve someone else's likes
Let me know if this worked for you.
I am trying to use facebook graph api to find out if a user has liked a particular page.This is the query I tried
https://graph.facebook.com/user_id/likes/page_id?access_token="my access token"
I tried the same kind of query to find if two users are friends but its returning empty data set even for that.
https://graph.facebook.com/user_id/frineds/user_id
How should I solve that issue?
You can use
GET /v2.2/{user-id}/likes/{page-id}
to find out if a user likes a page. Remember that you need the user_likes permission!
See
https://developers.facebook.com/docs/graph-api/reference/v2.2/user/likes#readmodifiers
For seeing if a user is a friend of another user, try
GET /v2.2/{user-id-a}/friends/{user-id-b}
You need the user_friends permission to do so.
https://developers.facebook.com/docs/graph-api/reference/v2.2/user/friends#readmodifiers
Is it possible to get the identities of users who have liked a page through the Facebook graph api? If so, what access permissions are required?
I have only been able to get the count via the /user edge.
That other thread got one answer that is correct:
Although you can't get a list of all the fans of a Facebook Page, you can find out whether a specific person has liked a Page.
Source: https://developers.facebook.com/docs/graph-api/common-scenarios
I have a simple tab page, php sdk working and I know I can get the "like" for this specific page from the user signed_request.
This page is a colaboration with another company who also has an FB page. What i´d like to know is if I can get the like status of their page for the current user so I can authorize an action on this tab that is dependant of the user liking both my page and my partner´s.
Is this possible without using an actual app, an access_token and the appropriate perms requested?
e.g. my page is fb.com/Coke and my partner is fb.com/Target
On this specific tab page I want to enable a button only if me (Coke) is liked (which I can get already) and if my partner (Target) is also liked.
I tried the graphAPI (me/likes) and FQL (using the connection table) and both compalin of an unauthorized request.
Short Answer:
No, this will not be possible in a production setting.
Further explanation:
Some users have their list of likes as public. In that case, it would work.
But in order to get likes from a user that has that setting as anything but public (such as myself, only friends of friends can see it), then it requires an app and an access_token that has a user_likes permission.
From the documentation:
Permissions Required:
user_likes permissions if querying the current user.
Previously, Facebook app's could check if a user liked a given page (for fan-gating) by calling the following Graph API method with no special permissions other than basic authentication:
/me/likes/page_id
This would return a data property with the page's details if the user has liked it previously, or an empty array when the user hasn't liked the page.
Seems that this has recently stopped working. Instead, the only way to get this information is, if the user_likes permission had been granted prior.
The same problem is encountered when using
/page_id/members/user_id
Is there any information on what's causing this new behaviour?
I'm guessing here, but the 2nd call you list would imply that the current user had rights to veiw your page's members list. Really the list of people who like a page should be restricted to the page owner although Facebook does show you who of your friends likes the page as well.
As for user liking the page, I've been searching today for the same and this answer seemed to be the best so far:
StackOverflow: Check if user likes page via Graph API