With the current v2.8 Facebook graph when retrieving /{pageid}/events ... cancelled events are not included is there a way to include them? Is canceled is useless then
Look at Facebook Graph API for Pages/Events. It is not very obvious from the document guide, but you need to add the ".include_canceled(true)" into your query URL. For example, look at the end of the following URL.
https://graph.facebook.com/v2.8/<PageName>?access_token=<AccessToken>&fields=events.include_canceled(true)
You can then add special query parameters and limiting to your query. As a bonus example,
https://graph.facebook.com/v2.8/<PageName>?access_token=<AccessToken>&fields=events.include_canceled(true).limit(10){name,start_time,end_time,description,place,is_canceled,cover,updated_time,attending_count,maybe_count,interested_count}&format=json&method=get&pretty=1
Related
The Short Version:
"I can visit the public page without being logged into Facebook and see underneath the post is says "2155 shares" I would like to know how to access that number through the API"
The Details:
I'm trying to use the newest version (v2.5) of the graph HTTP API to determine the total share count for a public video. The problem is FB seems to have changed the API enough that older posts on SO no longer answer this question.
Looking at the Graph API Documentation it appears that video nodes now have the "sharedposts" edge. However, calling this route with summary=true only returns a few of the shares and no value for a total count. This returns counts for comments and likes so I'm not using the endpoints incorrectly or messing up my authorization.
I've also tried to use the URL Node but this doesn't seem to do much with links inside of Facebook. I simply get a JSON response with an 'id' field with the same url I supplied as a request parameter. Seems like this route is meant to be used for links to content outside of Facebook.
I've tried the above methods with multiple videos on multiple public pages so I don't think it is due to the group owners restricting access, unless this is the new default.
It seems arbitrary that I would be allowed access to total counts for comments and likes, but not shares. Is there some legacy way to do this or am I out of luck for now?
You should query the Post element containing the Video element.
Each video posted is also contained in a post element.
The post id is then composed of the video id prepended with the posting entities id (user, page etc'), separated with an underscore.
It then looks like: user-id_video-id.
Then using the Graph API to get the share count of a post is straightforward:
GET /v2.5/{post-id}?fields=shares
Example
Lets take a video from the BBC page:
https://www.facebook.com/bbcnews/videos/10153524838517217/
(Please tell me if the link is broken. I'll switch it to something newer :))
Video id : 10153524838517217
Page id (see below): 228735667216
--> Post id: 228735667216_10153524838517217
And the request would be:
GET /v2.5/228735667216_10153524838517217?fields=shares
(open in the Graph API explorer)
Page id
to get the page id, you could query the video element for the from field.
GET /v2.5/10153524838517217?fields=from
Is there a way to get link statistics for multiple URLs using only one GET request?
Something along the lines of https://graph.facebook.com?links=[link1,link2,link3]
I know how to get single link stats
Facebook
https://graph.facebook.com?id=mylink
Twitter
http://cdn.api.twitter.com/1/urls/count.json?url=mylink
Linkedin
https://www.linkedin.com/countserv/count/share?format=json&url=mylink
There is not. Furthermore, Twitter will be removing their link statistics API call in November - see https://blog.twitter.com/2015/hard-decisions-for-a-sustainable-platform
Given a Facebook user id and a Facebook page id, is there any way to get find all interaction that user has done on the page (posting comments, liking posts etc) without first downloading the entire feed?
I have access key for the page and if necessary I can get one for the user.
For example on the page 315390295169855 (Ninja Saga page) user ID 100002190613755 has written a comment on the post 315390295169855_401357983239752. I would like to search that page so that such interactions could be found.
Things I have tried
I tried
https://graph.facebook.com/315390295169855/feed?q=100002190613755&access_token=FOO
But that doesn't seem to do the trick.
I have also considered first downloading the entire feed and then searching through it. However it turns out to be impractical, as for example the Ninja Saga page has tens of thousands of interactions and would likely cause the user to start playing farmville instead of waiting for the megabytes-long pre-search download to complete.
You have the answer there - pull the list of comments from the Posts you retrieve on the /feed connection of the page - i think the default return from a call to /feed includes a small number of the recent comments on each Post too, and you can retrieve the rest with a call to /POST_ID/comments
I have read through graph API document, and tried the following queries:
curl https://graph.facebook.com/search\?type\=checkin\&place.name\=Dante+Coffee\&access_token\=...
The access_token is valid. But it shows nothing like this:
{"data":[]}
I guess I only have the permission to access checkins sent from the owner of this access_token. And since I have never checkin this place, I got zero data from this query. But is it possible to get the total number of checkins with a place name by Facebook Graph API?
Although the FB docs say that Checkins are searchable, /search?q=woolwich&type=checkin gives me an error (#615) The checkin table does not support search..
But Places are searchable and the Place object has a checkins field (see /205142516170657?fields=checkins) - this should give you what you want.
When I type name of e.g. youtube clip in facebook search I can get number of people that share this link.
Is it posibble to fetch list of people sharing given like using facebook api?
No, you can't get who shared, only the total number. The easiest way to see the count is, for instance:
http://graph.facebook.com/http://stackoverflow.com
This solved my problem !
http://graph.facebook.com/http://stackoverflow.com
Creating Facebook apps was very easy, but now, you need to apply and ask for approval the app ... that sucks ...
You can do this with Facebook's FQL (Facebook Query Language), it gives you more information than the previously mentioned Graph API method, but Facebook are apparently going to turn off the FQL API on August 7, 2016. So its not going to be useful in the long term.
https://api.facebook.com/method/fql.query?query=select+comment_count%2C+like_count%2C+total_count%2C+share_count%2C+click_count+from+link_stat+where+url%3D%27stackoverflow.com%27
The interesting thing about this is it shows the result given by the previously mentioned Facebook Graph API request, i.e:
http://graph.facebook.com/http://stackoverflow.com
is actually giving the "total count", which is actually the sum of the likes, comments and shares of that link, the FQL method gives you the actual individual counts for comments, shares and likes.
Another method for getting the actual share count, is to use the links.getStats API call, but it appears to be undocumented, and nobody seems to know how long it will be available for.
Here's how to use it:
https://api.facebook.com/method/links.getStats?urls=stackoverflow.com&format=json