FQL return 0 as like count for few pages - facebook-fql

While running FQL query for retrieving page like count, i get 0 count for few pages. For most pages count comes fine but for few its always 0
Steps to reproduce:
Hit the following query:
https://graph.facebook.com/fql?q=SELECT+url,normalized_url,share_count,like_count,comment_count,total_count,commentsbox_count,comments_fbid,click_count+FROM+link_stat+WHERE+url+IN+(select+page_url+from+page+where+page_id+in+(344556287396,127535033990841,77277900503,293373084463))+
Expected Behavior
Correct like count should be returned:
http: //www.facebook.com/heyne.verlag (16,546)
http: //www.facebook.com/nwbVerlag (3,422)
Actual Behavior:
0 count is returned
I have checked with 150 pages, and find that FQL return 0 like count for 50+ pages. Please help me to fix this issue

This was by design. I was querying links of pages that are on Facebook.
link_stat reflects the interaction of users with a website, e.g. example.com. I made to query the page table in order to get the like count and was able to get correct count

Related

How to get all the posts in a Facebook group without a limit.? It only returns 25..?

I have used the call
GroupId?fields=feed{full_picture,place,from,comments{message},message,likes.limit(0).summary(true)}
to get the stated data for my application. But this only returns 25 feeds/posts. I also tried and limit number &limit=number (number like 1000) appending to the above. Yet it returns only 25. How to get all the posts?
Search for "Traversing Paged Results" in the docs:
https://developers.facebook.com/docs/graph-api/using-graph-api#reading
https://developers.facebook.com/docs/php/howto/example_pagination_basic
Some API calls have a max limit, so paging would be the only reliable way to get all items.

Facebook Graph Api: using limit with since and until

I am trying to use limit along with since and until in Graph Api call. In between a certain time interval, I have 2 uploaded photos. The query looks like this:
me/photos/uploaded?since=2009-12-31T18%3A30%3A00.000Z&until=2010-12-31T18%3A30%3A00.000Z&limit=200
This query has limit set as 200 , and it correctly returns the 2 photos. But the problem arises when I have a smaller value of limit, lets say 100. So basically a query:
me/photos/uploaded?since=2009-12-31T18%3A30%3A00.000Z&until=2010-12-31T18%3A30%3A00.000Z&limit=100
return me an empty json. Even though there are only two photos, a limit of 100 returns null. Any insights?

How to get shares count for a Photo in Facebook?

I want to get comments count, likes count and shares count for a page posts. I have their IDs and I'm trying to figure something out with the Graph API or FQL, but in vain.
For regular posts I can query the stream FQL table and I get the comment_info, like_info structures and shares_count variable.
For posted photos I can query the photo table and I get from there comment_info and like_info, but it lacks the shares_count.
I tried using Graph api like that: GET /550045508388715 and it returns a ton of information, but nothing related to share count.
I've googled that issue, but did not found any relevant solution.
Instead of GET /ID use GET /POST_ID to get the shares count (if >1). You'll get the result as-
"shares": {
"count": x
}
Note- the Post ID is generally: USERID_PHOTOID ORPAGEID_PHOTOID

Query every liked object using FQL

I'm trying to query every object which the user has liked since joining facebook by running this query:
SELECT user_id, object_id, post_id FROM like WHERE user_id=me()
This query runs fine and returns some results, but the number of them is a lot less than I estimated. I tried it on different, real user accounts, and for a friend of mine who has joined facebook around 2006 the number of returned results is still only around 65.
I tried this query through the official javascript sdk and through the graph api explorer which gave identical results.
The documentation doesn't state any limit imposed upon querying the like table.
Is there anything, I should be aware when doing a query on this table?
Thank you very much!
According to this documentation :
Each query of the stream table is limited to the previous 30 days or
50 posts, whichever is greater, however you can use time-specific
fields such as created_time along with FQL operators (such as < or >)
to retrieve a much greater range of posts.
Although not explicitly mentioned in the doucmentation for likes, I guess this will be the same limit. So try to add created_time in a where clause.

Facebook API get number of posts?

Given a page access token, how can get the total number of posts day by day?
You can query the FQL insights table: http://developers.facebook.com/docs/reference/fql/insights/
the insight you're looking for in in the Page Content section of that link.
However, that is an insight that is being deprecate on 2/15. So be sure to get your data quick. It's being removed from Facebook. I don't know why.
You can only retrieve a summary/count for published posts on a page. Something like this will work when querying the Page directly:
{PAGE}?fields=published_posts.limit(1).summary(total_count).since(1)
The response will look something like:
{
published_posts: {
summary: {
total_count: 12345
},
...
}
}
or if you want to query the published_posts directly, use:
{PAGE}/published_posts?limit=1&summary=total_count&since=1
The response will look something like:
{
summary: {
total_count: 12345
},
...
}
Setting limit to 1 ensures that your query is not unnecessarily large. If you're just needing the total post count, then set limit to 1.
The since parameter is a unix timestamp (milliseconds since January 1, 1970) and is required to retrieve the total post count. Set this to 1 as setting it to 0 will throw an error.
More details: https://developers.facebook.com/docs/graph-api/reference/page/published_posts/