Is it possible to get like-, share- and comment counts for an article (or other open graph object) without using FQL?
I'm aware that API v2.1 introduced the URL node which includes two fields called 'share_count' and 'comment_count'. But these are not the same values as the ones you get through FQL.
'share_count' appears to be the sum of likes, comments and shares.
'comment_count' appears to be a different value entirely, possibly comments published through the Comments Box plugin.
For a comparison, see the following links. (I'm unable to make the FQL query in Graph API Explorer for some reason.)
Old
New
Since API v2.0 will eventually expire, I'd rather not develop apps based on this version. But right now, I don't see any way of getting like-, comment- and share metrics for articles. I'd like to retrieve these metrics because they are more detailed than the new 'share_count' value.
Any ideas?
At present using link_stat FQL on v2.0 is the only option to get the drill down that you are looking for
https://developers.facebook.com/docs/reference/fql/link_stat
SELECT like_count, comment_count, share_count,total_count FROM link_stat WHERE url = 'google.com';
"data": [
{
"like_count": 3385562,
"comment_count": 2034401,
"share_count": 7514540,
"total_count": 12934503
}]
That breakdown isn't available via url or engagement https://developers.facebook.com/docs/graph-api/reference/v2.4/url https://developers.facebook.com/docs/graph-api/reference/v2.4/engagement
Maybe by the time FQL is deprecated there may be further endpoints that can give you the data.
Related
I know there are several related answers on SO, but none seem to answer my question.
I would like to know if there is way to get the number of likes for a URL, using Graph API 2.2.
I know how to obtain this info via FQL or REST API, but those are deprecated.
https://graph.facebook.com/?ids=some_url
This returns the number of "shares", which is a total of like + shares + whatever. I need only the number of likes.
https://graph.facebook.com/some_opengraph_id/likes?summary=true
This returns the number of likes, but that total seems to be much lower than what a query on FQL link_stat table would return. Also /likes returns a list of likes, but it doesn't seem to be a complete list.
So is it possible to do this via Graph API or only FQL / REST support this?
Thanks in advance!
I encountered the same behavior, but unfortunately afaik there are no other options currently. If you have a v2.0 app, you can continue to use FQL until August 7th, 2016.
I tried for several hours to get the total number of likes/comments of a photo/post using the new Facebook Graph API 2.1 but I didn't find how to do it.
I am able to photo and post details through the API but it contains only an subarray with some likes and comments (ID/Name pair), but no the total number. Graph API Reference for object/likes mention a total_count field but is not able to found in API response.
Can you please suggest me a way to do it?
I am using latest Facebook PHP SDK 4.
I faced this situation before. Facebook Graph API Explorer, in the Fields dropdown list, you can not find any field related to total_like or total_comment of a specific post ( via its object_id). That means Facebook Graph API does not support getting the total likes, comments of a specific post.
But, it support to get likes, comments data of a post via likes, comments fields. So by this way, you can get the entire data about likes, comments, therefore, you can get the total number of likes/comments. This solution is not good, I think. I think in the near feature, Facebook Graph API support the fields total_likes, total_comments.
/object_id?fields=comments.limit(1000),likes.limit(1000)
I am trying to query the FB graph API for all of my posts. I would like the result set to only feature items that I've posted on my timeline. Not other users, and not my likes or comments.
The documentation is extremely confusing and most of the knowledge I've gained is through trial and error. To date, the only proposed solutions to this I've found online require the use of FQL (such as in this similar question: Facebook graph api- how to get user feed,with out posts about likes and comment by the user?) however the FB documentation states that FQL is deprecated and will not be supported in the future so I would like to avoid it. Additionally this is currently structured as a url request and if at all possible, I would like to keep it so.
To date, I've tried:
/[userid]?fields=posts.limit(100).fields( picture, link, created_time, from, message, description, object_id )
which will get me all of my posts with the data fields I require, but it also includes "Likes" and when I "Comment" anywhere - which I don't want.
/[userid]?fields=feed.limit(100).fields( picture, link, created_time, from, message, description, object_id )
which returns only posts - but also includes posts made by others on my timeline (and I don't want those either).
It seems unclear to me if there is any more robust way to work with these different feed types as documented:
https://developers.facebook.com/docs/graph-api/reference/v2.0/user/feed/
Can anyone tell if there is a way to either limit the "feed" edge to only my posts (not including others posting to my timeline) or filter the "posts" edge to remove the "likes" and "comments"?
Instaead of /feed, you can use /posts.
More info here:
https://developers.facebook.com/docs/graph-api/reference/v2.0/user/feed
It's not possible as far as I know to generally apply filters to the Graph API calls, except very little exceptions.
/user/feed is an example (https://developers.facebook.com/docs/graph-api/reference/v2.0/user/feed/#read), where you can specify either with=location or filter={stream_filter}.
{stream_filter} in this case is a result of the filter_key field of the following FQL query:
select filter_key, name from stream_filter where uid=me()
Maybe you can try
GET /me/feed?filter=app_2915120374
which should give you the status updates.
I'm working on a module to my web application which is supposed to display latest news feed entries for a specific user.
I was wondering if it's possible to add a certain "orderby" parameter to the graph api url in order to fetch the "latest news" instead of facebook's default "top news" which arranges the order using popularity and other elements.
I'm currently using the following url:
https://graph.facebook.com/me/home?access_token=...&limit=10
but again, this does not return the latest entries.
Does anyone know how to solve this?
You can use FQL rather then Graph to query the "stream" table. FQL supports order by statements similar to SQL. http://developers.facebook.com/docs/reference/fql/
For your specific example it would be
SELECT post_id FROM stream WHERE source_id=me() ORDER BY updated_time DESC
Obviously you will want to query more then just the post_id, you can find the full list of fields here http://developers.facebook.com/docs/reference/fql/stream/
Mikey, I've been trying to do the same thing. During my tests I found that the Facebook API didn't return all the entries it was supposed to.
Meaby in some way it's prevent you from seeing all updates correctly.
Try this :
In your browser open : https://graph.facebook.com/me/home?access_token=
then
Go to the Facebook Graph API Doc : https://developers.facebook.com/docs/reference/api/
and click the News feed: https://graph.facebook.com/me/home?access_token=... link in the page.
Check if the two page show the same output.
I need to retrieve the number of fans for a given Facebook application. Using the GraffitiWall application example in the Facebook Graph API, that page displays a fan total numbering somewhere near 1.2 million. The Graph API, however, returns no fan_count:
{
"id": "2439131959",
"name": "Graffiti",
"description": "Graffiti lets you draw on your friends' profiles.",
"category": "Just For Fun",
"link": "http://www.facebook.com/graffitiwall"
}
Are the likes on the graffitiwall application likes for the page or for the application? If for the page, how do I programmatically determine the page ID given the application ID? If for the application, how do I get that fan count? Do I need to be an admin for that application? Is this only available using Facebook Insights?
For the record, I've also tried specifying the application ID, but that also returns the above block. Using the application page URL, a shares value is returned:
{
"id": "http://www.facebook.com/graffitiwall",
"shares": 19
}
Perhaps I'm missing something in the API documentation or the Graph API forum, but I couldn't find the answer in either location.
You can get number of fans by running FQL on page table:
FB.Data.query("select fan_count from page where page_id = 2439131959");
(fan_count is undocumented field btw, either it is deprecated or they just forgot to mention it in their docs which wouldn't surprise me much)
Not sure if you were asking about likes as well, but just in case here is an example how to get number of likes by url:
FB.Data.query('select like_count from link_stat where url="http://www.facebook.com/graffitiwall"');
You can also get fan_count using the REST API:
% wget https://api.facebook.com/method/pages.getinfo?access_token=[...]&fields=fan_count,name&page_ids=2439131959&format=json
[{"page_id":2439131959,"name":"Graffiti","fan_count":1263811}]
as described in the Facebook Developer wiki.