How to get the feed of a group with Facebook graph api - facebook-graph-api

I tried to get a group's feed using an access token from the Graph API Explorer https://developers.facebook.com/tools/explorer/?pnref=story using this route
https://graph.facebook.com/page_id/feed?access_token=access_token
and that worked perfectly; I managed to get the group's feed even though I didn't ask for any permission in the Graph API Explorer.
I tried to do the same thing but this time using the access token I get from users when they login using my application but that didn't work; an empty data array was returned even though the user is already a member of that group.
I searched more for that problem and some people said that I should request for the user_groups permission, but when I searched more I found that this permission is deprecated in the recent versions.
I searched more and I found that user_managed_groups would help, but the problem is that with that permission I can only get the feed of a group only if I'm an admin of that group.
My main goal is to get the feed of a group every time a user that is not an admin of that group but a member in it by using his access token.
My questions
Is there any other way to achieve my main goal?
Did I miss anything or make something wrong when I tried accessing the groups feed using the above methods?
Why didn't getting the group's feed using the access token I get it from my application work, but it worked when I used the access token from Graph API Explorer? What is the difference between an access token that comes from Graph API Explorer and the login API?
Can I somehow use the access token from the Graph API Explorer and regenerate it every N minutes -for example- automatically to use it to get the feed of the group that I'm a member of instead of using other user's access tokens?

Related

How to Use Scope in Facebook Graph API C# sdk

Before asking this question, I have searched a lot, but did not find a single working example for this. I want to retrieve the page access token for one of my pages. I read that scope should be passed as parameter with permission manage_pages. But its not working.
Here is my code: http://pastebin.com/GNVimbFX
Basically there's two steps that you need to do
Retrieve access_token with manage_pages permission
Get /me/accounts which would return you page access_token
You can read more here

July 2013 breaking changes: Graph API post search with or without access token?

The Developer Roadmap states in the Graph API search changes paragraph:
User access tokens will be required for all search Graph API calls except Posts, Places and Pages. App access tokens may also be used for Post search Graph API calls. Places and Pages search Graph API calls will still require an App access token. Search for Applications will no longer be supported.
But this Developer Blog Post says in the Graph API search changes paragraph:
App access tokens will be required for all search Graph API calls except Places and Pages. Search for application will no longer be supported.
So the first says that I will not need an User access token to search for posts (but I may use an App access token if I want to). And the second says that I need to use an App access token. I'm confused. Which one is correct?
There are a few things regarding the search API that I would like to mention to clear your confusion.
You can use the User Access Token for the Graph API search, for all types of nodes like Post, Places and Pages and retrieve the User's view of the result which might differ from other two cases. The difference arises basically from the permissions that other have for the respective User. I would recommend this over the others basically because the result might be more User respective.
You can use App Access token to get the Public view of the data from the Graph API Search. The data retrieved might be different or same as the other cases. Using this is a best thing to do in case of doubt over what access token is to be used.
To complicate the things further, you may even get away using Graph API search without any access token (Sample request /search?type=post&q=video). Although this is highly not recommended because Facebook might just change the API anytime requiring further changes in your app.
So in short use User Access token if you would want User view of data or if you just want public data for some statistics etc. you may use App Access token.
And to answer your question You will be required to use the App Access token after July 10,2013

Facebook: Graph 'posts' works but FQL 'stream' does not?

this shouldn't be this difficult. I assumed it was a permission thing, but then it doesn't make sense when the graph API gives me the information but the FQL doesn't. :S
so I'm just trying to get the stream from my public page:
http://www.facebook.com/207941570907
So I'm using their tool:
https://developers.facebook.com/tools/explorer
And I give the Graph API Explorer every single permission and I run this:
https://graph.facebook.com/207941570907/posts
And that works perfectly.. but I want to use FQL instead. So I figure running the following would be EXACTLY the same, but no data appears?! It WAS working a month ago, but I don't know what they changed.. sigh:
https://graph.facebook.com/fql?q=SELECT post_id, message FROM stream WHERE source_id = 207941570907
Does anyone have a clue what I'm doing wrong?
I was able to get, using the graph API explorer, the posts from pages I admin. I currently have all permissions for the access token I'm using.
Using the Graph API Explorer tool, I'd suggest looking thru the permissions to see which one you are missing. Or start with all permissions and start taking one by one off until it breaks.

How can I grab the wall feed of a logged in user's friends' groups?

The Graph API is currently not allowing me to grab the wall feed of groups that the currently logged in user's friends belong to. I'm able to see the feed if I navigate to the group manually, but the Graph API is not allowing me to access the feed. The documentation states that the feed (wall) can be accessed with any valid access_token, user_groups, or friends_groups (provided that the group has privacy settings set to OPEN). Is this an error in the documentation or am I missing something?
You don't specify whether you are having trouble accessing the list of groups itself, or just the wall feed of the groups. You also don't specify whether the friend account is itself a user of your app. In any event, it is not always the case that Facebook Graph API lets you access any information which you could access directly from http://facebook.com.
Solution found. Turns out I just needed to give the app the "read_stream" extended permission to access the wall feed.

What permission is need for one to use the type parameter in the Facebook Graph Api?

I used read_stream, publish_stream and manage_pages as the permissions for the facebook graph api so that i can access and manipulate a user's feed. I tried using the type parameter to filter the feed and return posts that have messages i.e. by adding 'type=message' to the url but this does not seem to work.
I have tried using the sample in facebook developers' page and it work there. I then compared the two urls (one from the facebook developers' page and the other from my web app) but the only difference was they had different access_tokens. Thus, i concluded that the problem might be the permissions so i am wondering what permission will allow me to perform this operation.
When you said 'Sample in Facebook Developers' page were you referring to the Graph API Explorer?
If so, the explorer automatically requests metadata on queries by silently adding a '?metadata=1' to the query.
If you need the metadata, you should add this too, bearing in mind that there's a namespace collision between the properties of some objects and the metadata (i.e some objects have a field named 'type' which is suppressed if you force the metadata to be returned - you get the 'type' field from the metadata instead)