Display Facebook Graph API likes count in my site - facebook

I'm using fields=fan_count in the Facebook Graph API to get the number of likes from my facebook page, but i don't know how to display the counter in my site.
That is the URL:
https://graph.facebook.com/gamersaction/?fields=fan_count&access_token=access_token
The URL is returning the number of likes and the id of my page:
I want to display only the fan_count field, how can i do it?

You can't, id is the primary key.

Related

Facebook api likes

I need to know if that's possible using the Facebook API?
Get everyone that liked my page (Less than 50 people)
Get all the pages they liked
Query to see if any of the people that liked my page liked my competitor page as well?
thanks,
Answer:
No way. Reference: graph api - retrieve list of likes of a page
Request https://graph.facebook.com/{user-id}/likes endpoint. Documentation: https://developers.facebook.com/docs/graph-api/reference/user/likes/
Request https://graph.facebook.com/{user-id}/likes/{page-id} endpoint. Documentation: https://developers.facebook.com/docs/graph-api/reference/user/likes/
3.1 Request FQL to check multiple userid in only one API call, for example, if one of the user id from the list (e.g. 4,5,12345,777) have liked the page, it would return the relevant user id, i.e. 12345 as shown in this screenshot.
SELECT uid FROM page_fan WHERE page_id = 279183048899677 AND uid In (4,5,12345,777)
Documentation: https://developers.facebook.com/docs/reference/fql/page_fan/
Facebook dismiss FQL after 8 Augsut 2016 Now you need to use only Graph API.

Facebook: How to get fanpage by domain search?

I would love to get the Facebook fanpage for a domain with the Facebook Graph search.
I tried the following, but only got a random id but not the pages id?
https://graph.facebook.com/?domain=stackoverflow.com
Question:
How to get the Facebook Pages Name or ID when i only have the url to query for?
Does the id from the above graph search help?
You can do it with this the Graph API search:
https://graph.facebook.com/search?type=page&q=stackoverflow.com

Display summery of likes from facebook page and web site

I want to integrate the number of likes that I have in my website with the number of likes that I have in my facebook application, so for example if user clicks on my site like button and another user click on my facebook page like, the total likes that I will see on both the applications(site and facebook) will be 2.
My question is is this possible at all or thous are 2 separate objects and it is not possible to sum there likes
Thanks
You can find the like count of your website by running the following FQL query:
SELECT like_count FROM link_stat WHERE url="yourwebsiteurl"
Then, you can get the like count of your app in one of two ways. If the like button for your app points to its apps.facebook.com address, use the same query as above, with its app URL instead of your website URL.
If the likes for your app are from a Page associated with the app then you should make a Graph API call to:
https://graph.facebook.com/YOURPAGEID?fields=likes
This will give you the like count for each object, now you just need to sum them.

Post Id from facebook

I am using Facebook graph API to upload photo to the Facebook and on return I am getting the object id (which is actually the photo id), but I need the POST ID of that particular post in order to get the details such total number of comments and total number of likes of that post.
Is it possible to get the post Id using object id? Or is there any Facebook API to get the comments count and likes count using the object id?
Making a call to https://graph.facebook.com/PHOTO_ID will return to you all the information (that you have permissions to see) for that photo object.
You can use the Graph API Explorer to test these methods out...

Facebook Graph API: How do I get a user's (or own) link-likes (i.e. 'user likes a link')?

By link-like I mean a generic page on the Web (link) that a user likes using a Facebook button (i.e. NOT a Facebook standard page).
The Graph API method /user/feed does not return link-likes.
The Graph API method /user/likes only returns Facebook page likes, but not link-likes.
Do you know of any ways that I could get to link-likes?
When you get this kind of entry you get and id something like:
"id": "1392236262_349397875123264"
The first part of id is user id, the second is the liked link id. You can get an information about it by running other Facebook Graph API call:
https://graph.facebook.com/349397875123264
This way you will get all information about this link.
You can get list of liked urls using fql:
SELECT url FROM url_like WHERE user_id = me()
http://developers.facebook.com/docs/reference/fql/url_like/