How can I get all the Facebook pages liked by a user? - facebook

I'm trying to know if Open Graph even allows to get all the pages liked by someone (and, if possible, only in a certain category), and if so, how would I be able to do that ?
Thanks a lot

Have a look at https://developers.facebook.com/docs/graph-api/reference/v2.0/user/likes to see how this can be achieved.
Basically you need to request /me/likes with an Access Token with user_likes permission.

Related

facebook graph api if a user has liked a page

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

How Do I Detect if a User Already Likes My Facebook Page when landing on my site without user_likes permissions

When a user lands on my website I would like to present him with a litebox with the like facebook widget in it. However I only want to do this if they haven't already liked our facebook page.
I want to make this process seamless so I dont want to have to ask for permission first.
I read somewhere that if its for your own sites FB page, then you dont require this.
But cant find any more information other than a person stating this in the stackoverflow.
Any help much appreciated.
thanks
andy
You would need to go through the review process with the user_likes permission. Facebook will not approved user_likes for that, because like gating is not allowed anymore.
It was possible earlier to check if a user liked a Page directly in a Page Tab/App, but that flag was removed.

manage_pages only a one fanpage

I need to get permission from a single fanpage and not of all, I have seen applications that do, I wonder if anyone knows how to do it!
Is that possible to give 'manage_pages' permission only to one page? How can I do it?
Thanks!

Get all posts on a friend's wall

I'm trying to find an API call (or set of calls) that will allow an app to get the posts that one would see if viewing a friend's wall. Either a REST call or a FQL call would do.
I tried /feed and /posts, compare the results with what I see on my friend's wall, and the results I get from it are incomplete.
I know this is possible because apps like Friendly are able to do it.
Any hints?
Well, there's two different API endpoints for querying the posts of a given user; home and feed. Home includes posts from other people and pages (basically what you see when you log in and go to your home page) and feed is the stuff the user is sharing. Assuming your application has authenticated the user and they've allowed the read_stream permission, you can then make queries to the Graph API using their access token:
https://graph.facebook.com/{SOME_USER_NAME}/home?access_token={SOME_ACCESS_TOKEN}
and
https://graph.facebook.com/{SOME_USER_NAME}/feed?access_token={SOME_ACCESS_TOKEN}
The only hint I could give you is that "incomplete" is pretty standard with the Facebook API. You can only do the best you can with what they give you. Counts will be wrong. Data will be wrong. It's a fluctuating, moving target, so code to that fact.
You can interact with posts by retrieving the read_stream and publish_stream for a given User's ID.
Once you have the ID of the User that you are interested in you can use FQL to retrieve posts from streams that you have the permissions for.
This stackoverflow answer goes into more detail and contains further links to the documentation on the Facebook Developers site.
We do it like this:
1) we use Facebook Platform PHP5 client
2) then what you do is:
$this->facebook = new facebook($key, $secret);
$out = $this->facebook->api_client->call_method("facebook.stream.get", array('viewer_id'=>0, 'source_ids'=>$uid, 'limit'=>$limit));
then just operate with out, which contains all posts on asked page.
but, afaik, it will work only with pages, not with normal users. but dig that way to get answer.
You should make a graph call to https://graph.facebook.com/< FBID >/statuses?access_token=xxxxx
Here access_token shall have read_stream permission and offline_access permission ..

Facebook - refer a friend

I'd like to enquire with the Facebook heads on here about how best to do the following:
I'd like to run a promotion from my Facebook business page that encourages users to recommend a friend in order to gain access to enter a competition. Obviously being in the Facebook environment it would be preferred to encourage Facebookers to refer friend's on their profile. Anybody know if there's an app out there (I've searched and not found) that does this? Does the Facebook API allow access to select specific friend(s) to notify on Facebook?
Thanks for your help & suggestions.
Yes, you need to have read_friendlists as an added permission to your facebook app.
From there I think you can do a FB.api() kind of call to get that information
Source
I think the requests dialog does what you were looking for?