9

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?

Kara
  • 6,115
  • 16
  • 50
  • 57
undetected
  • 474
  • 3
  • 12
  • 1
    So is there no answer because (1) it cannot be done, or (2) no one knows how to do it? – undetected Sep 11 '11 at 16:58
  • 1
    I also have been trying to tackle with this as well lately with no luck... it seems all wall photo posts, link posts and everything but regular status posts (or whatever they're called) are missing from /feed and /posts... I'd really appreciate it if someone could answer this question. – Zharf Sep 14 '11 at 06:09
  • I'm not sure *why*, but it seems like certain posts just aren't available through the API. When you say "apps like Friendly are able to do it", can you confirm that posts missing from your feed in your app are indeed available in other apps, like Friendly? – jches Sep 19 '11 at 22:09
  • @chesles When I log on as myself, and I view a Friend's profile page, I compare what Friendly shows and what the Facebook website shows, and they are the same. When I make Graph or FQL queries, I see a significantly reduced subset, no matter what combination of queries I try. – undetected Sep 23 '11 at 23:56
  • @steve I would not be able to use Java in the application I'm planning to write. However if there's a set of Java calls that make it work, I may be able to make the same calls via REST or the iOS APIs. – undetected Sep 23 '11 at 23:57

4 Answers4

7

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.

typeoneerror
  • 55,990
  • 32
  • 132
  • 223
  • Thank you, I think this was the best answer, whether or not undetected agrees. – Zharf Sep 21 '11 at 06:16
  • The problem is that /home gives me an error message: "You can only access the \"home\" connection for the current user." I want to write an app that will allow me to see what I can see on my friend's wall even though I'm logged in as me. – undetected Sep 23 '11 at 23:54
2

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.

Community
  • 1
  • 1
Kynth
  • 2,597
  • 1
  • 18
  • 24
  • The linked-to answer suggests querying the "stream" table through FQL. I've tried that and it's incomplete. I've tried "SELECT message FROM stream WHERE source_id ='" + friendId + "'" (incomplete results), and "FROM status" (empty). – undetected Sep 17 '11 at 05:52
  • By incomplete do you mean you are receiving some posts but not all? Double check you're submitting the query with an account that has permission to the users streams. Also make sure the stream you are trying to retrieve isn't private, Facebook are tighter on privacy these days. – Kynth Sep 17 '11 at 09:27
  • I've found that wall photo posts, link posts and such are all missing. I've been using mainly graph api lately but I think a coworker tried FQL and others before he went on vacation. I did request read_stream and publish_stream permissions when I logged in. I can view those posts on facebook through my account but not when I try to read them through the APIs. (ahh, finally got my comment posting privileges back) – Zharf Sep 19 '11 at 10:39
  • As typeonerror states, that's the best you're going to get with the Facebook API I'm afraid. Some days are better than others :) – Kynth Sep 21 '11 at 08:38
  • @Kynth I wonder though how 3rd party apps are able to do it consistently. At least that's been my experience with the Friendly iOS app. – undetected Sep 24 '11 at 00:00
  • You're looking at it from a query Facebook at the time your user views your service. One method is to run a background job which queries for all of your users periodically then aggregate all of your results in time for when your user logs onto your service. – Kynth Sep 24 '11 at 08:54
2

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.

jancha
  • 4,916
  • 1
  • 24
  • 39
  • Thanks for sharing, but I'm trying to get the entries one would see if they viewed the profile page of a friend. – undetected Sep 24 '11 at 00:00
0

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 ..

mjs
  • 657
  • 7
  • 14
  • I have tried /statuses, /feed, and /posts and I'm still not seeing the entries that I could see when viewing a friend's profile page logged in as myself. – undetected Sep 23 '11 at 23:59