Unable to Receive Wall Posts after OAuth - facebook

First off, I am new to using Facebook's Graph interface but I've read the documentation and am still unable to retrieve the desired result. First I was able to set up an app account and retrieved my App ID and App Secret, I then set up and advance OAuth Dialog that will ask the user for read_stream permissions (accessing the news feed). I have successfully had three users go throught the authenticator and it allows me to see more of their data but still no wall post (which I assume is the news feed). Below are the steps I followed if someone can help. Thanks. (Sidenote - All urls below came straight from the facebook documentation.)
https://www.facebook.com/dialog/oauth?client_id=XXXXXXX&redirect_uri=http://myurl.com/wheredataisdisplayed&scope=read_stream&state=SomethingIndentifiable
returned: state and code=1XXXXXXXX, I then used that to get the OAuth Token
https://graph.facebook.com/oauth/access_token?client_id=XXXXXXX&redirect_uri=http://myurl.com/wheredataisdisplayed&client_secret=XXXXXXXXXXXXXXXXXXXX&code=1XXXXXXXX
returned access_token = XXXXXXXXXXXXXXXXX and expires = 9875067805, I then tried to query the data for that user
https://graph.facebook.com/me?access_token=XXXXXXXXXXXXXXXXX
The end result is more data than what is publicly available but I still don't have access to the users wall data. Another thing I want to do with this is to use it with an infinite session key so that once the user does this once they will have continued access to their data but that I can work out later, Thanks for any help in advance.

Are you accessing /me/feed correctly, and if so are you receiving an error message when you do so, or just nothing back?
/me/feed should work for this.
You can also request /me/permissions to check if the correct permissions were granted which may help you solve the issue

Related

How to get all posts from facebook even those were geo targeted?

I'm using graph API to get posts from facebook for a specific page, but there are some posts that are targeted to a specific region and those never come in the results.
I'm requesting posts like this:
https://graph.facebook.com/FBPage?fields=id,name,link,picture,posts{message,picture,link,likes,from,feed_targeting,targeting}
That's return all posts global posts but the geo targeted ones not.
Does anyone here know if there is any possibility to filter a specific region to get those posts or even request that facebook don't take in consideration the geo target information?
SOLVED: The problem was really with tokens, to solve we got a user that has access to all pages that we need and generate a token using its credentials, that token make all the magic happens.
You can only try using a User Token, so you should get all those posts the User can see when he visits the Page manually. I assume you are using an App Token right now.
You can also try using a Page Token, in theory you should get all posts that way.

Facebook API for Share returning empty results set

I am new to Facebook API. I am building a Facebook app to fetch all the name of people who shared, commented and liked a post in a tabular format. I am able to get the like and comment details through Facebook API but can not find and proper API to get the share details.
I am using
https://graph.facebook.com/post_id?fields=sharedposts&access_token=my_access_token.
This API is returning an empty result set. And I have granted all the available permission to the access_tokn. Can anyone tell me ,Is there any other API that I can use. I saw a option of scraping the Facebook page for share,but I don't want to go that way because Facebook keeps on updating every thing.
I'm having the same problem as you, but I think I'm going a little step forward.
Try adding a limit to your sharedposts and maybe it will return some data:
Try this way:
https://graph.facebook.com/post_id/sharedposts?access_token=my_access_token&limit=1000
That should work for a regular post.
EDIT: Maybe the problem could be that althought you have granted all the perms to the token, the people who share that posts have to accept that permission too.
Otherway your JSON won't return any data.
The /sharedposts endpoint will -only- retrieve posts from users who have -also- granted your app. This means that even though a post might be public on a users' timeline, unless they have also granted your app permissions, you will not be able to retrieve that post.
For example: a user posted to a page and the post is public. This post can be retrieved with an access token. Let's assume that the user also shared this post to their own timeline. But, since the user has not granted permissions to your app, you will not be able to see this post using the /sharedposts edge on the original post (on the page). This also holds if the user shared their post publicly to his timeline.
This behaviour is by design; the API is more restrictive in returning user data than the website is. This holds for multiple endpoint and this is one of the examples where it is the case.
Source: https://developers.facebook.com/bugs/1404733043148335

Fetch users who has checked in at particular location or page from Facebook Graph API

I would like to fetch the users list from Facebook Graph API 2.0 who has checked in at particular place or a page. I tried to use this way:
https://developers.facebook.com/docs/graph-api/reference/v2.0/page
But it does not provide that information. Can this be a privacy issue?
Is there a way that if I am a page admin of the place, where people check in, I can fetch the user ids of those users?
Any kind of help or guidance will be very appreciated.
Regards
This is not possible IMHO, because the user's checkins are bound to the OAuth access restrictions, meaning that every user need to give your app the permission to request his data.
As you already refrences, the Page itself has no edge for the checkins: https://developers.facebook.com/docs/graph-api/reference/v2.0/page#edges

Open Graph api for feed returning inconsistent results

Called the https://graph.facebook.com/{id}/feed url is randomly missing data.
Here's what I did
Create a test user for my sandbox mode app with publish_stream and read_stream permissions
Add a post to their wall via POST to graph.facebook.com/{id}/feed?access_token={token}
Login as test user and confirm post was added to their news feed
GET on graph.facebook.com/{id}/feed to view JSON data
So when I hit the feed, sometimes the successfully created Feed Post is in the JSON, and sometimes it's not. Continually hitting that API endpoint (i.e. hitting refresh over and over in my browser) will have the data pop in and out in no discernable pattern.
I have no idea what I could be doing wrong, or if it's just Facebook for that matter. What could be the problem?
I experienced this as well. My solution: Add 'user_groups' to the list of required permissions. Log out, log in again and everything should work.

Facebook Graph API post with attachment not showing on News Feed

I tried a number of methods of posting to Facebook using Graph API and I have a problem with creating a post with attachments not showing up in the News Feed.
If I post just a text message, it shows up in the News Feed. Anything that has an attachment goes only to the wall.
Does anyone have an idea on what is the cause of this and how to fix it?
I have no idea what was the cause of the issue, but I resolved it by creating a new Facebook App, with new ID. The same scripts that only posted to the wall started posting to the news feed on the new App ID.
I think it's because you're adding attachement or a link to your feed.
As per http://developers.facebook.com/docs/fbjs/streamPublish/
they say :
Updating a User's Status
You can use this method to simply update a user's status. When you do so, the status message appears at the top of the user's profile and on the Friends > Status Updates page. The message also appears in the stream with your application icon.
To use this method to set a user's status do the following:
* Do not include an attachment or action link. If you do, the story will get published and will appear in the stream and on the user's Wall only. It won't appear at the top of the profile or in the Status Updates page.
* Make sure the message is no longer than 420 characters. Otherwise, an error gets returned.
I know this is an old post but I was having the same issue and I resolved it. Since there wasn't a valid answer to this post and it came up in many of my searches in Google I thought I would add the answer.
The main issue that is happening here is a permissions issue with the App and Access Token created in https://developers.facebook.com.
You can both GET and POST attachements on a wall but you have to give the Users Access Token the permission to access it in the first place. You can do it like this.
1. Go to your application on FB
2. Click on Graph API Explore
3. Click on Get User Access Token
4. Click on user_photos and user_videos
There are many options here but to get the basic attachements which tend to be photos and video you can just select those two, but you can add as many as you want.
After clicking Get Access Token at the bottom to save it you have to login with your password then give your access toke permission for your account. Once you have done that you now how permission to access your feed attachements (photos and videos)
Here is what the Graph API output looks like showing the picture from the feed
Now keep this in mind this is a Short Lived Access Token which lasts about an hour and it will stop working. You have to convert this token to a permanent token and let me save you the time you will bang your head trying to figure that out because I wrote a php function that will generate your permanent token from your short lived token all in one shot for v2.9
Check out my post reply here
facebook: permanent Page Access Token?