GET Facebook Page Post Video Source is not working - facebook

I am using Facebook Graph API, to get Page post.
https://graph.facebook.com/v2.7/357708837646769/posts?access_token=TOKEN&limit=25&fields=id,name,type,link,description,message,picture,source,from,created_time,object_id,shares,likes.limit(1).summary(true),full_picture
This API works fine. and returns value.
However when I get a post type video, I try to fetch to Video Source using below API:
https://graph.facebook.com/v2.7/716404295377384/?access_token=TOKEN&fields=source
https://graph.facebook.com/v3.1/716404295377384/?access_token=TOKEN&fields=source
Here is the Page post doc on Facebook
https://developers.facebook.com/docs/graph-api/reference/v3.1/post
If we check the fields, for source it says:
Name: source
Description: A URL to any Flash movie or video file attached to the post.
Type: string
However, the API is not returning any value for "source" field. Tried with both 2.7 & 3.1 Graph API version. Also Facebook has not mentioned anywhere, that the "source" field is deprecated or won't be available in API.
Any help?

Also Facebook has not mentioned anywhere, that the "source" field is deprecated or won't be available in API.
They mention the following change in the changelog for v2.12,
https://developers.facebook.com/docs/graph-api/changelog/version2.12#gapi-90-videos
Page-owned videos — The source field will no longer be returned for Page-owned videos unless the User making the request has a role on the owning Page.
So, are you using the right kind of access token …?

Related

Facebook API returns empty videos list

I'am trying to play with the opengraph facebook API. I'd like to fetch my videos by calling /me/videos
I'am using the Opengraph API explorer with a user access token but the response is always empty: {data:[]}
My token is generated with every acces rights (I checked all checkboxes).
/me/photos is working fine, but not /me/videos
Any idea?
Thank you
Depending on your comment I can tell your question doesn't describe what you're looking for. You're not looking for your uploaded/tagged videos, so this endpoint won't work for your case.
Just for information, this endpoint will only return a list of videos that the person is tagged in. You need to specify to this endpoint by adding a type=uploaded parameter to the query if you're also looking for the video uploaded by you.
Source: https://developers.facebook.com/docs/graph-api/reference/video
You're looking for your bookmarked links and it seems the API endpoint to access Facebook "Saved Links" is not available anymore (Is there a way to get the Saved Links?)

Get Share Count of Public Video with FB API v2.5

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

"unsupported get request" for a post that exists and is publicly visible

The following public post which is visible on the page it was posted (it is not "hidden") is a mystery to me: https://www.facebook.com/Orange.France/posts/833781953305851
i.e., it is not available in the page's /feed edge, and the graph API can't retrieve it either. The following command returns an "unsupported get request":
curl https://graph.facebook.com/170852259598827_833781953305851?access_token=XXX
I tried also the following without much success:
curl https://graph.facebook.com/833781953305851?access_token=XXX
In both cases, I tried the access_token of the page as well a random access_token generated from the graph explorer.
So, the question is: how can I retrieve this post through the FB API ?
You can't retrieve that post via the API - it was made by a user whose data cannot be accessed via the API by any app due to their privacy settings
You can see this by trying to load the poster's details (https://graph.facebook.com/<username>- it fails with the same exception)
Such posts will never be accessible via the API, because the person who made the post has explicitly disabled all apps from interacting with them or their posted content
If you want to prevent such users from posting on the page, there's an API-settable option called which will stop this - documentation for how to apply settings to the pages your app manages is here: https://developers.facebook.com/docs/graph-api/reference/page/settings
The specific option you need to enable to prevent platform-opt-out users from posting is called PLATFORM_OPTOUTS_CAN_POST
The main reason is not because of page, but it's because of the author turn the platform off.
You can't query the author basic info via Graph API.
The author can turn the platform off, so any Graph API query including comments wouldn't include him.

Facebook Comments Widget - Access via Graph "Unknown identifier"

My site is using the Facebook comments box plugin. I can access the comments using the graph api for my iOS app by calling:
https://graph.facebook.com/comments?ids={url}
However, if the url referenced above isn't visited at least once in a browser I'll get the error:
{
error: {
type: "Exception",
message: "Unknown identifier, ",
}
}
It makes sense that the url hasn't been registered yet via the plugin. However, I might be accessing these urls in my iOS app before anyone visits them on the web. Does anyone know of a graph api call that will register the url with Facebook? If my situation were read only I would simply say there are no comments but I have the same problem when trying to post a comment.
You can programmatically scrape a particular page containing a social plugin by making a CURL (or similar) call to:
http://developers.facebook.com/tools/debug?url={YOUR_URL}&format=json
This is mentioned in the OG docs at http://developers.facebook.com/docs/opengraph/#edit although links to the older URL for the OG Linter.
I believe linting/scraping a page such as this should register any social plugins on the page without requiring you to visit the page first.
Edit: See also the Updating Objects section at the bottom of this doc: https://developers.facebook.com/docs/opengraph/objects/

Facebook graph API: feeds missing in json response

I try to fetch user's feeds via graph api from my Android application. It generally works but some feeds that I can see on the wall are missing in the json response.
I call the url http://graph.facebook.com/someUserId/feed, by using the Android Facebook SDK methods, so the access token should be provided automatically, but it's not really relevant I think in my case. Nevertheless fyi, the user of my app is authenticated via OAuth.
I already checked the following:
all the user's feeds are visible to everyone / public (set in privacy settings)
the json response is not cached by my browser
I am aware of paging, but this is not an issue. The problem is not that I am not getting the very oldest feeds but that some feeds are just missing in between.
I registered a new facebook user which is not connected to the user I want to retrieve the wall feeds from, and when I open the respective wall I see all the feeds there, as expected, since they're all public to everyone. Yet, when I open the same related json url unter http://graph.facebook.com/someUserId/feed, some feeds are missing.
This is an example of the problem - since all my posts are public, I can just call the json url directly in a browser to do a test.
I want to get wall feeds from user:
http://www.facebook.com/mathias.lin
Screenshot1: note the 3 marked postings, all posted by myself
and here the json response, as you can see, the 1st and 3rd wall posts are included in the json, but the 2nd post is not. Why?
The related json url is:
http://graph.facebook.com/mathias.lin/feed
I am getting the 'missing' feed when I add an access_token to the url - but why? The posted feed has a privacy setting for 'everyone'?!
This is the missing feed that I get when using the access_token:
{"id":"504063796_485195138796","from":{"name":"Mathias Lin","id":"504063796"},"message":"Photo test upload from Android","picture":"http:\/\/photos-e.ak.fbcdn.net\/hphotos-ak-snc6\/hs021.snc6\/165194_485195123796_504063796_6062399_1841907_s.jpg","link":"http:\/\/www.facebook.com\/photo.php?fbid=485195123796&set=a.485195118796.256450.504063796","name":"Torres Photos","icon":"http:\/\/static.ak.fbcdn.net\/rsrc.php\/yz\/r\/StEh3RhPvjk.gif","actions":[{"name":"Comment","link":"http:\/\/www.facebook.com\/504063796\/posts\/485195138796"},{"name":"Like","link":"http:\/\/www.facebook.com\/504063796\/posts\/485195138796"}],"privacy":{"description":"Everyone","value":"EVERYONE"},"type":"photo","created_time":"2011-01-06T05:10:43+0000","updated_time":"2011-01-06T09:00:23+0000","likes":6,"comments":{"data":[{"id":"504063796_485195138796_3607414","from":{"name":"Mathias Lin","id":"504063796"},"message":"Awesome, photo upload now works as well. Not so much fun working with the Facebook SDK for Android, would have expected more functionality beyond that just very very simple graph api wrapper. But need to be considered that the android sdk development was part of an internship - but since it's it's open source, it can luckily be modified. Which has to be done due to some bugs (mixing up the bundle parameters for a post, getString, getByteArray). Api documentation could be improved.","created_time":"2011-01-06T05:26:04+0000"},{"id":"504063796_485195138796_3608020","from":{"name":"Renate Hermanns","id":"628810487"},"message":"Wow
, how fast time passes by. Your daughter is nearly grown up ;-).","created_time":"2011-01-06T09:00:23+0000"}],"count":2},"attribution":"Torres"}
I've already posted the question to the FB dev forum, awaiting response.
Related threads:
http://forum.developers.facebook.net/viewtopic.php?id=81365
http://forum.developers.facebook.net/viewtopic.php?id=75984
Facebook Graph API "/userid/feed" returning Blank
Your approach is correct, I've seen the JSON and yes it's missing the second one, I think it's upload app form adroid, try checking the application settings for this app. Or If your trying to retrieve the wall FQL is a much better way
SELECT post_id, actor_id, target_id, message FROM stream WHERE source_id in (SELECT target_id FROM connection WHERE source_id=<uid> AND is_following=1) AND is_hidden = 0
I've been through this, the way Facebook is categorizing their permissions is somehow misleading, for example Publicly available may sounds like Available to everyone on Facebook but apperantly it's not.
Now in your case, if you already authenticated the user, then try using:
/me/feed
I guess this is the only case where access_token is not needed in the URL.
I had a similar problem. But for me, the problem was related to not setting the scope properly on first login (to authorize the app). I posted a similar question and got an answer that worked for me here:
Facebook API how to get all wall items