AdamNYC
AdamNYC

Reputation: 20445

Querying earliest post of a Facebook user using Facebook Graph API or FQL

I would like to query earliest posts of a Facebook user using FQL or Graph API. The big issue is by default, Facebook limit return items, which are ordered by descending time.

I know I can limit my query by until, but I don't know what date to put in, because I have no idea when my user become Facebook member. I have to do search like:

find post until Jan 2006
if null, then find post until Jan 2007
if null, then find post until Jan 2008
....

which I hate so much.

Is there a smarter way to find out earliest posts by user?

Upvotes: 1

Views: 935

Answers (2)

A Sharma
A Sharma

Reputation: 656

If you are indeed trying to find when did a user join Facebook, I agree with phwd's answer.

The best way I have been able to find out (which is also cheaper than having to reiterate through tons of posts) is accessing the earliest "profile pictures" of the user. This is making the assumption that a user would post a profile picture soon after creating their account.

Once you can get access to "Profile Pictures" album, you might be able to use created_time field for the album (or sort Profile Pictures by created_time for individual photos).

Even if the earliest photo was deleted, what are the chances that the user stays without any profile picture for a long time?

Reference: https://developers.facebook.com/docs/graph-api/reference/v2.0/album

Upvotes: 1

phwd
phwd

Reputation: 19995

First off, it's near impossible to have an all encompassing program that determines when a user joined Facebook, to put it quite bluntly. I know from your past questions, you have been trying but many have tried before you, it's not possible.

For example what happens if no one decides to write anything on my wall from the date I joined to 1 year after? That indicator becomes pretty inaccurate now does it?

Anything smarter is based on assumptions that may or may not hold true.

e.g.

  • Assumption 1: Every Facebook user would publish a post on or near when they joined
    • this give an initial guess based on A1
  • Assumptions 2: Given A1, any post by a friend on a user's wall that is posted before the unix time returned by A1 will be earlier in date
    • this will always be true as long as A1 holds.

All of this falls when there is a year between actual activity and join date.

You can minimize the set returned by calling less data per item and more items overall

/me/feed?fields=created_time&limit=200

Then you page until there is no next paging parameter left.

Upvotes: 2

Related Questions