Reputation: 23
I have a little problem with the Facebook api.
I am doing a very simple FQL request to get a Page's stream like this one :
SELECT post_id, type, likes, comments FROM stream WHERE source_id = X
It works just well. But, when I do the same request on "huge pages" like Coca Cola or Starbucks, all stream posts have an empty "type", "likes count" and "comments count".
I don't really understand why. I am thinking about a "Global Page" with country code error, but I just can't find information on this.
Any idea ?
Edit: just try another request to get the page global child IDs, but looks like Coca Cola and Starbucks doesn't use the Global Page system.
starbucks?fields=global_brand_children.username,global_brand_parent_page
So, any idea why my first request return empty infos when getting stream content ?
Upvotes: 2
Views: 651
Reputation: 22873
There is nothing wrong with "huge pages". It's only that "huge pages" have a lot of posts and shares from fans. Indeed, the stream
table provides ALL the activities of the page.
The type
of a stream activity will be null
when the content comes from a user. When it comes from the page owner, it will be an int. See the description of the type
field on https://developers.facebook.com/docs/reference/fql/stream/.
The reason why you might get a null
as a like count
is that you came across a post which has the can_like
or can_comment
fields set to false
. These posts cannot be liked or commented because they are present outside of the page (i.e. on a user timeline or on particular website) and their owner didn't allow public likes or comments (even if publicly visible). If you are going to find such activities in the stream of the page is because they tagged the page in their message or photo.
Edit in answer to your first comment.
Question: why doesn't the following query give back the posts from the owner of the page:
SELECT actor_id, message
FROM stream
WHERE source_id = 40796308305
AND actor_id = 40796308305
Let's see how many results this query CAN give back:
SELECT actor_id, message
FROM stream
WHERE source_id = 40796308305
Okay, we get 17 results. Why 17? I don't know.
When you add AND actor_id = 40796308305
to your request, it will checks among these 17 results which ones have 40796308305
as an actor_id
.
Answer? None!
Because it only checks the 17 first results, you'll have to indicate a LIMIT
:
SELECT actor_id, message
FROM stream
WHERE source_id = 40796308305
AND actor_id = 40796308305
LIMIT 100
And there you get what you want.
This is one of the Facebook API's subtlety. Documented here: https://developers.facebook.com/blog/post/478/
Upvotes: 3