Get last posted photos from facebook graph - c#

I see that FQL is deprecated?
We now use the Graph API and with url .
What I want is to get all the latest pictures of my friends and NOT from pages or other stuff.
If I use:
me/home/?filter=app_2305272732
will I also get back pictures from pages and more.
How can I ONLY get pictures of friends.

Since you would need to use the read_stream permission to get friend postings in the stream of the authorized user, and since friend permissions are gone, there is no way to achieve this. You will not get read_stream approved: https://developers.facebook.com/docs/facebook-login/permissions/v2.2#reference-read_stream
Information about the friend permissions are in the changelog: https://developers.facebook.com/docs/apps/changelog
You can only get the latest photos and posts of the authorized user by authorizing him with the user_status permissions and using /me/statuses.

Related

Not able to get user info ( who commented ) of comments in a facebook page using graph api explorer

I am trying to get all the comments and users who commented those.
Using graph API explorer, for a particular page using page access token, I am able to get all the comments for a post and users who commented.
But using facebook App, I am only able to get comments and not the users who commented.
The user has Admin role on that page.
following are the steps I am following :
This returns list of pages and there page access token.
https://graph.facebook.com/me/accounts?access_token=XXXXXXXXXXXX
This returns the list of posts in that page
https://graph.facebook.com/{page-id}/posts?access_token=XXXXXXXXXXXX
This returns the list of comments
https://graph.facebook.com/{post-id}/comments?access_token=XXXXXXXXXXXX
In the last step I am suppose to get user details along with comment.
What am I missing ?

Getting null value for friends while retrieving data from Facebook

I am trying to get friends list from Facebook using Facebook C# SDK.
FacebookClient fb = new FacebookClient();
dynamic me = fb.Get("me");
But I am getting all other data from me except friends related(id,name..) data,
its always giving null value.
Does anyone know what is the Problem?
Yes, the "problem" is stated in the docs:
Friend list now only returns friends who also use your app: The list of friends returned via the /me/friends endpoint is now limited to the list of friends that have authorized your app.
See
https://developers.facebook.com/docs/apps/changelog#v2_0_login
FB has (somewhat) recently changed their API such that when you request the logged in user's friends, you only get those friends who are also using your FB application.
Unless you register your FB app as a game, you will not be able to see all of the logged in user's friends, only those who have also logged into your app, and have not disabled the option to show up in other people's friend lists.
Be aware that you can't simply lie that you are making a game, FB has to review your app before giving you persmissions to see the full friends list.

Getting facebook group id from group url

i have tried to get facebook group id (gid) by it's url using C#, with no luck.
I have looked over the facebook graph tables, tried PHP, FQL queries, and even tried P3P to get the feed itself of the group page (To get the 'cid' value) - But again - with no luck, I'm getting a token successfully using facebook SDK but I dont understand how to use it to get the group id or the group source code (which always returns the login page), can you help ?
You can fetch the username from the url- string after last /. You can find how to do that. Then simply use the Search API.
You'll be needing a valid user access token with the API call-
/search?q={group-username}&type=group
Example: https://graph.facebook.com/search?q=progressivenagars&type=group&access_token={access-token}

Get Facebook posts on my application

Is there any way we can get posts, status of Facebook to show in our application based on some Keywords or GEO location. I have done it for Twitter using developer account where I used to apply some token keys and gets the result in json format.
Is there any similar way to get posts from Facebook developer account?
You can use the Search API to search based on keywords. Like this:
https://graph.facebook.com/search?q=football&access_token={ACCESS_TOKEN}
To search for objects near a geographical location, use type=location and add the center and distance parameters: /search?type=location&center=37.76,-122.427&distance=1000
Here's more detail: http://api-portal.anypoint.mulesoft.com/facebook/api/facebook-graph-api/docs/reference/search

post a comment to facebook from app

So the goal here is to ask a user to post something to their wall with a specific hashtag , when they do this I would like to post a comment to this post from our app with something like "Thank you for your post, come back to http://www.mysite.com for the next step". So far I successfully query the user's posts , and I am successfully finding the post with the specific hashtag. When I find the post I also get the post_id of the post.
So after reading everything I could find from the docs , I am able to post a comment from the user if I do something like this with graph api. (This is using Facebook c# sdk)
FacebookClient client = new FacebookClient();
client.Post("832586561_10152125349566562/comments", new
{
message = "test message from app"
});
now with this code I am using the user's access_token, and it works fine , but on Facebook it will show up as the user commenting on their own post. That is not what we want , we want the comment to appear to be coming from our app. So I tried using the app access token instead of the user's access_token, and when I try i get an error for not enough permission. I do not even know if this is possible to be done with the app access token. I tried adding all the extended permissions that I could find that had anything to do with publiching and I still get the error for not enough permission , right now I ask for these extended permissions on login.
{ scope: 'email,publish_stream,email,rsvp_event,read_stream,user_likes,user_birthday,publish_actions,manage_pages' });
Does anyone have any idea how I can post a comment to a specific post and have that comment comming from the app?

Categories