get large picture from facebook open graph - facebook

I'm using taggable_friends permission and I get very small pictures:
{
"id": "AaKG56CVqePjK3sFxWO2DvvazqwT7CM1kHfFlWUGyMKCHZmc1t-xlvh3PqRXAurLfMJRAcBB1b7HeJnr7j6DnY_GNYI976qDM-2BbJY08yx8TQ",
"name": "test test",
"picture": {
"data": {
"is_silhouette": false,
"url": "https://fbcdn-profile-a.akamaihd.net/hprofile-ak-xpl1/v/t1.0-1/p50x50/13907064_1214534405258556_1797869389967198661_n.jpg?oh=01a39553b932d419072ae015ff6574c1&oe=58589721&__gda__=1481901827_b29caab5f5a0d89f73304f2e88478a99"
}
}
},
{
"id": "AaKUkJL9BixC7nuGF_aufISzRm2L64nay4h07UHvn3sTMDqcFOhVBPPR4zf2zEfxuDa4sF9ywcTlgQHPTMVRfXCaLUXvYnR0B2xnt-VQKt9X0A",
"name": "test test",
"picture": {
"data": {
"is_silhouette": false,
"url": "https://fbcdn-profile-a.akamaihd.net/hprofile-ak-xtp1/v/t1.0-1/p50x50/10491155_1596823763928928_7193716970229043400_n.jpg?oh=b3dd2392ae30f8fba5f764872a7c6559&oe=5845F2FF&__gda__=1482475262_ffca8317fb938e328474426e66272f3c"
}
possible to change the url and increase the photo?

I prefer using specific pixel values for the minimum sizes (if the picture resolution is big enough):
/me/taggable_friends?fields=id,name,picture.width(500).height(500)
This would be another solution:
/me/taggable_friends?fields=id,name,picture.type(large)
Reference: https://developers.facebook.com/docs/graph-api/reference/user/picture/

Related

getting multiple photos from Facebook post

I'm now playing with Facebook's Graph API and I'm trying to copy Facebook's posts from a page that I'm administrating to another place.
So far I managed to succesfully get message and full_picture, the problem begins with posts that have several pictures in as if I never get more than one picture from a post.
Graph API reference for posts tells only about returning one link for one picture or full_picture and I didn't find any mentions about getting the biggest number of pictures possible.
Is there any way to get all pictures from posts?
You can get them via the attachments, at least for posts I have made
$ okurl https://graph.facebook.com/v3.1/10153937378849343_10156680000194343/attachments
{
"data": [
{
"subattachments": {
"data": [
{
"media": {
"image": {
"height": 540,
"src": "https://scontent.xx.fbcdn.net/v/t1.0-0/p180x540/xxx_n.jpg",
"width": 720
}
},
"target": {
"id": "10156680000094343",
"url": "https://www.facebook.com/photo.php?fbid=xxx"
},
"type": "photo",
"url": "https://www.facebook.com/photo.php?fbid=xxx"
},
{
"media": {
"image": {
"height": 540,
"src": "https://scontent.xx.fbcdn.net/v/t1.0-0/p180x540/38918411_10156680000119343_5451882299853373440_n.jpg?_nc_cat=0&oh=ac71357254bb90e14e4a658531ff370b&oe=5C08C9C2",
"width": 720
}
},
"target": {
"id": "10156680000109343",
"url": "https://www.facebook.com/photo.php?fbid=xxx"
},
"type": "photo",
"url": "https://www.facebook.com/photo.php?fbid=xxx"
}
]
},
"target": {
"id": "10156680000194343",
"url": "https://www.facebook.com/542634342/posts/10156680000194343/"
},
"title": "Photos from My post",
"type": "album",
"url": "https://www.facebook.com/542634342/posts/10156680000194343/"
}
]
}

Getting high res photos from Facebook News Feed API

I am trying to get a high resolution photo from the post below in my news feed. I tried calling https://graph.facebook.com/v2.1/10154603506630195 using the object_id based on advice here (getting high resolution photos that were posted on a page wall/feed) but it doesn't seem to work, any help would be much appreciated :)
{
"id": "10154603665915195_10154603509055195",
"from": {
"id": "10154603665915195",
"name": "John Smith"
},
"message": "I've taken up queuing as a new hobby during my short time in England. Here we are outside a store that won't open for another half hour...",
"picture": "https://fbcdn-sphotos-h-a.akamaihd.net/hphotos-ak-xpf1/v/t34.0-12/s130x130/10699259_10154603507605195_419931109_n.jpg?oh=ff3ec0e772fea164bbd9d61e9ee9a4d0&oe=540E80D2&__gda__=1410242521_d3b2dc1c8f971610b07e0408cd62815b",
"link": "https://www.facebook.com/photo.php?fbid=10154603506630195&set=a.10150303996795195.555860.698310194&type=1&relevant_count=1",
"icon": "https://fbstatic-a.akamaihd.net/rsrc.php/v2/yx/r/og8V99JVf8G.gif",
"actions": [
{
"name": "Comment",
"link": "https://www.facebook.com/10154603665915195/posts/10154603509055195"
},
{
"name": "Like",
"link": "https://www.facebook.com/10154603665915195/posts/10154603509055195"
}
],
"privacy": {
"value": ""
},
"type": "photo",
"status_type": "added_photos",
"object_id": "10154603506630195",
"application": {
"name": "Facebook for iPhone",
"namespace": "fbiphone",
"id": "6628568379"
},
"created_time": "2014-09-07T10:40:03+0000",
"updated_time": "2014-09-07T10:40:03+0000",
"likes": {
"data": [
{
"id": "711243852300920",
"name": "Megumi Yoshida Atobe"
},
{
"id": "10152707756462594",
"name": "Emily Stokes-Rees"
},
{
"id": "10152741507272044",
"name": "Lina Kumamaru Sato"
}
],
"paging": {
"cursors": {
"after": "MTAxNTI3NDE1MDcyNzIwNDQ=",
"before": "NzExMjQzODUyMzAwOTIw"
}
}
}
}
If you are using the FB Graph API, ask for the full_picture field in your request:
FB.api('10153224297552834_10153268631032834?fields=full_picture', function (response) {
console.log(response.full_picture);
});
Try specifying the attachments field in your request.
/v2.2/<someId>/feed?fields=attachments
This will give you an 'attachments' field, with some media inside. You'll find there high res images.

Publish a story on Facebook timeline

I'm very new to Facebook Open Graph. What I want to do is simply when a user opens a webpage, it will send a story to his/her timeline. I have created an "Eat a Meal" action on Open Graph. When I click Get code, I get something like this :
https://graph.facebook.com/me/project:eat?
access_token=ACCESS_TOKEN&
method=POST&
meal=http%3A%2F%2Fsamples.ogp.me%2F325653997592127
When I click on this code, I am redirected to another page. I get an Access Token there and then when I click submit I get something like this :
{
"id": "274655529384281"
}
When I click the id, I get this :
{
"id": "274555552716206",
"from": {
"id": "274673726099999",
"name": "Jason McJason"
},
"start_time": "2014-07-16T14:23:26+0000",
"end_time": "2014-07-16T14:23:26+0000",
"publish_time": "2014-07-16T14:23:26+0000",
"application": {
"name": "Project",
"namespace": "project",
"id": "325123427594834"
},
"data": {
"meal": {
"id": "539535656565608",
"url": "http://samples.ogp.me/325625656562127",
"type": "project:meal",
"title": "Sample Meal"
}
},
"type": "project:eat",
"likes": {
"count": 0,
"can_like": true,
"user_likes": false
},
"comments": {
"count": 0,
"can_comment": true,
"comment_order": "chronological"
}
}
But I don't know what to do with all of this data. I just have a simple HTML page. Where should I put these data? I'm a little lost and Facebook's documentation didn't help much. I'd appreciate if you tell me what to do with these. Thanks.
You need to integrate Facebook JS SDK on your web page.
Read up through this documentation- https://developers.facebook.com/docs/javascript/quickstart/v2.0
The very last example creates a post.

Facebook API: Get the photo by its id in albums (and change the size)

I'am working with iOS and the graph API, i made a table cell to choose between the differente Albums from Facebook.
I want the user to choose a photo, and the get the photo url in 400x400 by his ID
Like when i get his picture by
https://graph.facebook.com/id.facebook/picture?width=300&height=300
Here is the request :
IDFACEBOOK?fields=id,albums.fields(photos.fields(id))
And here is the result:
{
"id": "100004371731895",
"albums": {
"data": [
{
"id": "159236757565381",
"created_time": "2013-02-28T13:51:13+0000",
"photos": {
"data": [
{
"id": "159236790898711",
"created_time": "2013-02-28T13:51:16+0000"
},
{
"id": "159236810898709",
"created_time": "2013-02-28T13:51:18+0000"
},
{
"id": "159236820898708",
"created_time": "2013-02-28T13:51:19+0000"
}
]
}
},
{
"id": "153859634769760",
"created_time": "2013-02-10T19:27:31+0000",
"photos": {
"data": [
{
"id": "157894851032905",
"created_time": "2013-02-23T16:20:18+0000"
},
{
"id": "153859638103093",
"created_time": "2013-02-10T19:27:31+0000"
}
]
}
}
]
}
}
Anyone have an idea on how to proceed ?
Thanks in advance.
Bye bye !
In your field expansion, request the images parameter which is "The 4 different stored representations of the photo", each containing height, width, and source fields.
So, the field expansion becomes:
/IDFACEBOOK?fields=id,albums.fields(photos.fields(id,images))
For each photo, use the source with dimensions closest to the height and width you need and then resize the image. There's ton of tutorials for resizing images on iOS, search google.

Is there a way to get recent video.watches activity for a specific app?

I want to give the user a UI to delete activity. I'm aware of it, but I'd rather not use the Activity social plugin. I know that it is possible to get activity using Graph API:
me/video.watches
example response:
{ "data": [ {
"id": "10101573590568760",
"from": {
"id": "123546",
"name": "John Doe"
},
"start_time": "2012-02-01T18:53:34+0000",
"end_time": "2012-02-01T18:53:34+0000",
"publish_time": "2012-02-01T18:53:34+0000",
"application": {
"id": "123456789123",
"name": "test_app"
},
"data": {
"movie": {
"id": "123456789123456789",
"url": "http://example.com/movie/My-Movie-Title",
"type": "video.movie",
"title": "My Movie Title"
}
}, "likes": {
"count": 0
}, "comments": {
"count": 0
}
}
However, for global action types, this may return other apps as well. I am only interested in my app specifically. Is there a way to limit returned data to my app only?
Appears that video.watches only returns activity items for the current app.