Simon Thomsen
Simon Thomsen

Reputation: 1421

Get posts by other on page wall (Facebook API)

I've searched around, but can't find the answer, so I try here.

Is it possible to get posts by others on a page wall (See image as example: http://d.pr/i/fklT) via. Facebook's API?

I've tried with /PAGE_ID/posts, but that only gives me updates created by the page and not by the people that liked the page

Upvotes: 4

Views: 3045

Answers (3)

ggll
ggll

Reputation: 973

Using graph api, you can get all posts (including those by others) querying the field "feed" instead of "posts", eg /PAGE_ID/feed. I got this from this other answer:

https://stackoverflow.com/a/14401026/1449045

Upvotes: 1

Natan R.
Natan R.

Reputation: 5191

As Martin said, it's possible with the Graph API using FQL. I tried Martin's solution, but needed to change it a little bit.

Defining filter_key = 'others' didn't help. Instead, you can replace it for actor_id != YOUR_PAGE_ID, so, in the end, you can have:

https://graph.facebook.com/fql?q=SELECT post_id, created_time , app_data, type, actor_id, target_id, message FROM stream WHERE  source_id = YOUR_PAGE_ID AND actor_id != YOUR_PAGE_ID&access_token=YOUR_ACCESS_TOKEN

If you need more variables, you just need to put them after SELECT, and you can check them out here: https://developers.facebook.com/docs/reference/fql/stream

On iOS, you don't need to put the access token in the query. To check how to do it with the latest iOS SDK, see my answer here: https://stackoverflow.com/a/14357179/675486

Upvotes: 3

Martin Müller
Martin Müller

Reputation: 2535

This is possible by using FQL instead of the normal graph objects:

https://graph.facebook.com/fql?q=SELECT post_id, actor_id, target_id, message FROM stream WHERE filter_key = 'others' AND source_id = YOUR_PAGE_ID&access_token=YOUR_ACCESS_TOKEN

More about FQL: https://developers.facebook.com/docs/reference/fql/

Upvotes: 1

Related Questions