Embedding facebook videos in website - facebook-graph-api

Using the Graph API I request /me?fields=videos.type(uploaded).fields(id, embed_html). This gives me a list of my uploaded videos:
{
"id": "[...snip...]",
"videos": {
"data": [
{
"id": "10151488520332264",
"embed_html": "<iframe src=\"https://graph.facebook.com/video/embed?video_id=10151488520332264\" width=\"190\" height=\"240\" frameborder=\"0\"></iframe>",
"updated_time": "2013-02-28T11:09:14+0000"
},
[...snip...]
]
}
}
I expect embed_html to be html code that embeds the video. But when I use it, the iframe shows only a graph error:
{
"error": {
"message": "Unknown path components: /embed",
"type": "OAuthException",
"code": 2500
}
}
The video is public and I get the same error also in the graph explorer when requesting it with an access token that has permissions for user_videos.
The video object also has a source property which links directly to the source video file (no player). I could use that and build my own player, but I'd prefer to use the embed code that facebook thinks is best for the video (and browser).

Related

error with searching Facebook Graph API user search

i want to user Facebook graph api to search for user information
but i get an Error when i write
GET graph.facebook.com/v3.3/search?q=java&type=user
{
"error": {
"message": "Unsupported operation",
"type": "OAuthException",
"code": 100,
"fbtrace_id": "GLFKEUeypcH"
}
}
https://developers.facebook.com/docs/graph-api/advanced#search lists the available search types - those are place, placetopic, and several ad_* searches for targeting purposes.
You can not search for users any more.

Facebook API process shared object [duplicate]

I just tried through the Graph API Explorer with this path /v2.4/10153513872748291 and I've got this result:
{
"error": {
"message": "(#12) singular links API is deprecated for versions v2.4 and higher",
"type": "OAuthException",
"code": 12
}
}
But https://developers.facebook.com/docs/reference/api/post/ doesn't say anything about deprecation.
I'm not sure if I miss something, or there's another way to get info about an individual post.
Edit: v2.3 works, but v2.4 is the latest one.
Looks like you now need to the combination of the id of the user or page that made the post (or whose wall it is on), an underscore, and then the post id.
For your example post, 10153513872748291, that is made by a page Drama-addict, that has the id 141108613290 – so 141108613290_10153513872748291 will work.
And so does 788239567865981_10153513872748291, because 788239567865981 is the id of the user making the post.
Firstput userId underscore add postId /Likes to check Like status in facebook
userId_post_Id/Likes to fetch Likes Records
userId_post_Id/Comments to fetch Comments Records
https://developers.facebook.com/tools/explorer/145634995501895/?method=GET&path=303261006522998_751199848395776%2FLikes&version=v2.9
**In this link Right side Get Token indide GetAccessToken to select Permission**
303261006522998_751199848395776/Likes
303261006522998_751199848395776/Comments
{
"data": [
{
"id": "124778301449917",
"name": "Manisha Gera"
},
{
"id": "1680577265523548",
"name": "Rubi Sharma"
}
],
"paging": {
"cursors": {
"before": "MTI0Nzc4MzAxNDQ5OTE3",
"after": "MTY4MDU3NzI2NTUyMzU0OAZDZD"
}
}
}

Get the post's text using Graph Api Explorer

I want to get the post's text using the post ID using Graph Api query at Graph Api Explorer. I am trying as;
GET/v2.8/{14346289902472_1788429604532785}
and
GET/v2.8/{14346289902472_1788429604532785} HTTP1.1
as documentation says;
But both prompts errors;
{
"error": {
"message": "(#803) Some of the aliases you requested do not exist: {14346289902472_1788429604532785}",
"type": "OAuthException",
"code": 803,
"fbtrace_id": "AKd65t6sFzI"
}
}
and
{
"error": {
"message": "Unknown path components: /1.1",
"type": "OAuthException",
"code": 2500,
"fbtrace_id": "DbFPezM2JiA"
}
}
How can I get the post text using post ID?
Edit 1
Where did you get that id from in the first place?
Visiting https://www.facebook.com/14346289902472_1788429604532785 redirects to https://www.facebook.com/ImranKhanOfficial/posts/1788429604532785, and when you look up the page name ImranKhanOfficial via API, you find its page id is 143462899029472.
So
14346289902472
instead of
143462899029472
And once you use that as the “prefix” for the post id, it works perfectly fine: https://developers.facebook.com/tools/explorer?method=GET&path=143462899029472_1788429604532785&version=v2.8
You are trying to get a single feed item.
GET https://graph.facebook.com/v2.8/143462899029472/feed?id=1788429604532785
{
"error": {
"message": "(#12) singular statuses API is deprecated for versions v2.4 and higher",
"type": "OAuthException",
"code": 12,
"fbtrace_id": "CJpKkf7emZS"
}
}
Graph api does not allow you to do this.
Just get the feed GET https://graph.facebook.com/v2.8/143462899029472/feed and iterate over the results until you find the one you want. If you don't find it in the first set, then paginate and get it in the next set.

Model directory expected to contain the 'export.meta' file

During the creation of a new version for a model after the selection of a bucket and folder I got this error from the Cloud Console.
{
"error": {
"code": 400,
"message": "Field: version.deployment_uri Error: The model directory gs://ml-codelab/v1-output/ is expected to contain the 'export.meta' file. Please make sure it exists and Cloud ML service account cloud-ml-service#xxx.iam.gserviceaccount.com has read access to it",
"status": "FAILED_PRECONDITION",
"details": [
{
"#type": "type.googleapis.com/google.rpc.BadRequest",
"fieldViolations": [
{
"field": "version.deployment_uri",
"description": "The model directory gs://ml-codelab/v1-output/ is expected to contain the 'export.meta' file. Please make sure it exists and Cloud ML service account cloud-ml-service#xxxx.iam.gserviceaccount.com has read access to it"
}
]
}
]
}
}
You need to create a meta graph when you export your model. You can do this using a saver e.g.
saver = tf.train.Saver()
saver.save(sess, os.path.join(FLAGS.output_dir, "export"))
Typically you save the session and graph separately because your serving graph can be different from the training graph.

Facebook Graph API calls

When i use GET /v2.4/{photo-id} in graph API explorer
It throws an error :
{
"error": {
"message": "(#803) Some of the aliases you requested do not exist: {user-id}",
"type": "OAuthException",
"code": 803
}
}
what does this really mean ? any help
You seem to be passing {user-id} which is not a valid data to query about.
Instead, use the below code without {user-id}:
GET /v2.4/{photo_id}
{photo_id} is an id of a post most probably in the userid_postid ("10000_00001") format.