A few days ago facebook stopped displaying share count information in graph. how is it currently downloaded to display on a page in php?
always after entering this link, there was also information about the number of shares and currently there is no: https://graph.facebook.com/https://demotywatory.pl/4922745/Dziecko-nie-wie-ze-to-rzezba-po-prostu-chce-pomoc
ย I want to display this information on my website. how to do it? please help
This info is now provided under the engagement field of the URL object node.
https://developers.facebook.com/docs/graph-api/reference/v3.2/url
/?id={url}&fields=engagement
https://developers.facebook.com/tools/explorer?method=GET&path=%3Fid%3Dhttps%3A%2F%2Fdemotywatory.pl%2F4922745%2FDziecko-nie-wie-ze-to-rzezba-po-prostu-chce-pomoc%26fields%3Dengagement&version=v3.2
Its working like below with facebook's app_id & app_secret.
https://graph.facebook.com/?id={URL}&fields=engagement&access_token={your-app_id}|{your-app_secret}
output :
{
"engagement": {
"reaction_count": 5,
"comment_count": 3,
"share_count": 60,
"comment_plugin_count": 0
},
"id": "https://www.testing.com"
}
Related
I am trying to retrieve the number of likes for posts in a Facebook page. For instance, I am calling the following endpoint from Graph API explorer
nba?fields=posts{message, likes}
to retrieve posts from NBA page. But I only managed to retrieve message and id but not the likes. Is it because of new privacy policy?
`
{
"posts": {
"data": [
{
"message": "๐๐๐ฎ Does ANYBODY get better bench reactions than Klay Thompson??
๐: Golden State Warriors x Cleveland Cavaliers Game 3
๐บ: 9 pm/et Wednesday, #NBAonABC",
"id": "8245623462_10156593269718463"
},
{
"message": "๐ธ x #NBAFinals Game 2",
"id": "8245623462_10156593260853463"
},
{
"message": "Game 2 in #PhantomCam! ๐ the BEST of Stephen Curry, LeBron James, & more slowed all the way down.
NBAFinals presented by YouTube TV",
"id": "8245623462_10156592692223463"
},
{
"message": "George Hill added 15 PTS, 3 AST for the Cleveland Cavaliers in game 2 at Oracle Arena. #NBAFinals presented by YouTube TV",
"id": "8245623462_10156590505838463"
},
{
"message": "๐ฃ Stephen Curry somehow beat the shot clock with this WILD 3-pointer! Hear how it sounded around the world #GlobalGame ๐๐
`
https://developers.facebook.com/docs/graph-api/reference/v2.12/object/reactions
Likes are call "reactions" now ,(
thumb and , emoji reactions)
But I only managed to retrieve message and id but not the likes. Is it because of new privacy policy?
Yes. You will need admin access (page access token) now to get individual likes.
If you only want the number of likes though, you can ask for the summary field:
nba?fields=posts{message,likes.summary(1)}
And be aware, you will still need to get your app reviewed for Page Public Content Access, otherwise you wonโt be able to get any info about pages you do not have admin access to. It works using above example link when using the Graph API Explorer app id - but as soon as you switch to one of your own, you will get an error saying you need PPCA, if the app in question isnโt already approved for that.
Yes it is, more information than public available (by example the likes, now just called reactions) options will be closed soon.
Insights API works properly for link feed but it doesn't work for photo feed. For photo feed, Insights API returns 0 or empty even though Insights page shows a high reach and engagement rate.
Here is the url pattern of my photo feed:
https://www.facebook.com/[PAGE]/photos/a.xxx.xxx.[PAGE ID]/[POST ID]/
Insights API returns:
{
"id": "[PAGE ID]_[POST ID]/insights/post_story_adds_by_action_type_unique/lifetime",
"name": "post_story_adds_by_action_type_unique",
"period": "lifetime",
"values": [
{
"value": [
]
}
],
"title": "Lifetime Talking About This (Post) by action type",
"description": "Lifetime: The number of unique people who created a story about your Page post by interacting with it. (Unique Users)"
}
I've been struggeling with the same questions... one thing I can tell you is, that you most likely used a wrong id for you photo post.
Please ensure that you ONLY use ID's retrieved by a facebook api. So this is a sample process:
1. Note your page-id
2. Use GRAPH to query <url-to-graph>/<page_id>/feed?access_token=<your_token>
3. From the response, take the photo-post-id you want to analyze
4. Use GRAPH to query <url-to-graph>/<id_from_step_3>/insights/?access_token=<your_token>
5. Check the metrics returned from step 4 and enjoy!
Please keep in mind that there's an undocumented need to add your page_id to any post_id. So every replacement of {post-id} as it is written in the FB api's will be _.
Hope that helps...
I have a problem with Facebook Graph API. Is there any way to "attach multiple photos within a status post" using the Graph API (Javascript SDK)?
With the iOS Facebook app can post a status with multiple photos.
However, after looking through the documentation on internet I couldn't find out how it works.
Does anyone have idea? This a status screenshot that I would like to generate with the Facebook API.
This could be a solution:
Create a post with just a message, get its ID
Upload all your photos with { "published" : "false" }, get their
IDs
Update each photo with { "target_post" : "<yourPostID>",
"published" : "true" }
Did you see this documentation ? https://developers.facebook.com/docs/opengraph/usergeneratedphotos/
it might help you
We're working on developing a program that will (hopefully) automatically swap out creative with new creative once a certain like threshold is met (i.e. if 100 people like the page, something new appears). Can we add coding so our system is able to tell how many "likes" are generated? I know that the number of likes are displayed, I'm just not sure if there is a way for a program to actually read how many likes there are.
I don't see if in any of the Facebook attributes in the developer's platform.
What you'll have to do is acquire an access token for your page and then query the facebook platform for the number of likes periodically (possibly with a cron job of sorts).
You can read more about how to get the page access token at this URL
https://developers.facebook.com/docs/authentication/
Facebook has given us a great took to help us mine all the data it holds - its called the Graph API Explorer and with it you can see what data will be returned when you query the API. When you query the API with only the page_id you'll get a response similar to this :
{
"id": "XXXXXXXXX",
"name": "My Awesome Page",
"picture": "foo.jpg",
"link": "https://www.facebook.com/pages/XXXXXXXX",
"likes": 345,
"category": "Product/service",
"website": "XXXXXXX",
"founded": "2011",
"description": "...",
}
For more information about how to use the Graph API you can see this link :
https://developers.facebook.com/docs/reference/api/
Facebook does provide good documentation:
http://developers.facebook.com/docs/reference/api/page/
As you can see there, there is a field "likes" containing the number (count) of likes for a page.
I'm developing an app on facebook and want to get the last date that the user of my app liked anything on Facebook.
It doesn't matter if its a page, post, comment, link or anything else you can like on Facebook.
Is it possible?
Thanks!
Actually, you can. (Probably added since Peter Bailey wrote his answer.)
Each like has a created_time field. The likes connection of a user object in the graph API returns most recently liked objects first. So if you just fetch the most recently liked item and check its creation time, you can get this data.
The API GET call would be:
/me/likes?limit=1
and the result would look like:
{
"data": [
{
"name": "Steve Jobs",
"category": "Business person",
"id": "113529011990795",
"created_time": "2011-09-23T02:22:22+0000"
}
],
}
You can play with this on the Graph API Explorer.
No.
A timestamp or other type of date value is not part of the information retrievable for likes. Not through FQL nor through the Graph API.