Vik
Vik

Reputation: 9299

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" using FQL ?

Upvotes: 1

Views: 8184

Answers (3)

Vik
Vik

Reputation: 9299

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'
) 

Upvotes: 0

ifaour
ifaour

Reputation: 38135

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.

Upvotes: 4

Matej Baćo
Matej Baćo

Reputation: 1332

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)"

Upvotes: 0

Related Questions