FQL query to fetch all feeds by page name
Hie
Can someone please tell me how to fetch all the feeds of a facebook page say "cocacola" 开发者_JS百科using FQL ?
You can use one query something like:
SELECT post_id,message
FROM stream
WHERE source_id IN (
SELECT page_id
FROM page
WHERE name='coca-cola'
) LIMIT 5
BUT it's not recommended searching by name, since it may return more than one page. If you know the page_id
use it directly. If you are a fan of the page try querying the page_fan
table first.
Why not just use graph:
http://graph.facebook.com/cocacola/feed
[edit]
You could try with 2 query-es, one for getting page id and second for getting stream. You can even try to combine them using fql.multiquery like this:
"query1":"SELECT page_id FROM page WHERE name='cocacola'" "query2":"SELECT message FROM page WHERE source_id IN (SELECT page_id FROM #query1)"
SELECT post_id,message
FROM stream
WHERE source_id IN (
SELECT page_id
FROM page
WHERE name='coca-cola'
) and actor_id IN (
SELECT page_id
FROM page
WHERE name='coca-cola'
)
精彩评论