Yury
Yury

Reputation: 20936

How to get the posts that a friend reshares using FQL?

I faced with the following problem. I would like to know how to get all the posts that has been reshared by my friend using FQL. I use the following query:

SELECT post_id, type, source_id, actor_id, target_id, via_id, app_id FROM stream WHERE source_id=<friend_id> AND via_id LIMIT 0,100

but unfortunately it returns an empty list. At the same time, when I execute the following query for my account I get the list:

SELECT post_id, type, source_id, actor_id, target_id, via_id, app_id FROM stream WHERE source_id=me() AND via_id LIMIT 0,100

I generated a token for all possible permissions. Could someone, please, point me how to solve this problem?

Upvotes: 4

Views: 527

Answers (3)

St&#233;phane Bruckert
St&#233;phane Bruckert

Reputation: 22903

Your both queries are correct.

SELECT post_id, type, source_id, actor_id, target_id, via_id, app_id 
  FROM stream 
 WHERE source_id=<friend_id> AND via_id 
 LIMIT 0,100

It is only that, through the API, you can't access Users from depth 2. For instance, it is impossible to get your friends' friendlist.

If one of your friends shared one of your friend's post, then you will see one result. If one of your friends shared a random user's post, then no results.

For privacy reasons, the API only allows to access the information in a quite closed circle of friends.

Upvotes: 2

Ivan T
Ivan T

Reputation: 1046

Try this:

SELECT via_id, link_id, caption, url
FROM link 
WHERE owner={user_id}

via_id will show you the unique identifier of the original link poster. If via_id=0 you are the original linkposter.

At least it will work for links.

Upvotes: 0

Augustus Francis
Augustus Francis

Reputation: 2670

Yeh.. I was wondering about the question as well for some time..

Using Graph API we can get all the links that I have shared..

GET me/links?fields=link

Upvotes: 0

Related Questions