Bigger picture for facebook news feed - facebook

I tried the Facebook Graph API Explorer and looked into the news feed of a person with /[userid]/feed.
In this case, the person added a new cover photo which is at least 720px wide.
But in the news feed, all I found was a picture attribute containing a very small 130px wide thumbnail only.
Is there a way to access the full - or at least a bigger - picture within the API?
Thank you.

If you check the data coming back from the /[userid]/feed API call, you'll notice "object_id": "xxx" in the response.
If you make a second API call to this, e.g. /xxx/, you will get an array of images back with different sizes you can use. E.g.:
{
"id": "000",
"created_time": "...",
"from": {
...
},
"height": 223,
"icon": "https://fbstatic-a.akamaihd.net/rsrc.php/v2/yz/r/StEh3RhPvjk.gif",
"images": [
{
"height": 480,
"source": "https://fbcdn-sphotos-b-a.akamaihd.net/hphotos-ak-xfp1/t31.0-8/1912152_448929725237759_238021965_o.jpg",
"width": 1547
},
{
"height": 320,
"source": "https://fbcdn-sphotos-b-a.akamaihd.net/hphotos-ak-xfp1/t31.0-8/p320x320/1912152_448929725237759_238021965_o.jpg",
"width": 1031
},
{
"height": 130,
"source": "https://fbcdn-sphotos-b-a.akamaihd.net/hphotos-ak-xpa1/t1.0-9/p130x130/1013838_448929725237759_238021965_n.jpg",
"width": 420
},
{
"height": 225,
"source": "https://fbcdn-sphotos-b-a.akamaihd.net/hphotos-ak-xfp1/t31.0-8/p75x225/1912152_448929725237759_238021965_o.jpg",
"width": 725
}
],
"link": "https://www.facebook.com/147587828705285/photos/a.448909598573105.1073741827.147587828705285/448929725237759/?type=1",
"picture": "https://fbcdn-sphotos-b-a.akamaihd.net/hphotos-ak-xpa1/t1.0-9/s130x130/1013838_448929725237759_238021965_n.jpg",
"source": "https://fbcdn-sphotos-b-a.akamaihd.net/hphotos-ak-xfp1/t31.0-8/q71/s720x720/1912152_448929725237759_238021965_o.jpg",
"updated_time": "2014-03-12T19:58:08+0000",
"width": 720
}

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/"
}
]
}

Facebook GraphAPI picture/full_picture permanent link

How can I get a permanent link for pictures in a post? For example, I can get all information about one post:
912163612218997/?fields=picture,full_picture,attachments
{
"picture": "https://scontent.xx.fbcdn.net/v/t1.0-0/s130x130/15390764_10154771322382505_5131571043698309499_n.jpg?oh=de4126b3944deb9fb7fca6b534e5e987&oe=58E45F29",
"full_picture": "https://scontent.xx.fbcdn.net/v/t31.0-8/s720x720/15326300_10154771322382505_5131571043698309499_o.jpg?oh=414291d1c1fbc88988afb887177a03c5&oe=59156F5D",
"id": "189675924467773_912163612218997",
"attachments": {
"data": [
{
"description": ...,
"media": {
"image": {
"height": 372,
"src": "https://scontent.xx.fbcdn.net/v/t31.0-8/s720x720/15326300_10154771322382505_5131571043698309499_o.jpg?oh=414291d1c1fbc88988afb887177a03c5&oe=59156F5D",
"width": 720
}
},
"target": {
"id": "10154771322382505",
"url": "https://www.facebook.com/photo.php?fbid=10154771322382505&set=gm.912163612218997&type=3"
},
"type": "photo",
"url": "https://www.facebook.com/photo.php?fbid=10154771322382505&set=gm.912163612218997&type=3"
}
]
}
}
However, these picture links are temporary. It won't be available after several hours.
Is there any way to get the permanent picture URL from Facebook GraphAPI?
I sort of figure out a workaround using redirect:
Fire graph API using object id and get CDN URL
Redirect to the CDN URL
Basically, as long as we know the object id, we can get the URL. Unfortunately, it is a bit slow.

Getting a High Resolution picture from Facebook API

Facebook FQL API for Photos states the maximum resolution for a photo returned from the API is 960x960:
The Photo object has an equivalent src connection. Using photo_src
FQL, you can retrieve images with the following dimensions: 960, 720,
480, 320, 180, 130, 75 pixels.
However, some images are uploaded at a higher resolution. Sometimes even much higher.
When browsing Facebook regularly, you can see these pictures and view their full size. However, I can't seem to find any way to get the original resolution in the API.
Is this possible and I have missed something? And if it's not - why?
Getting the max size of a picture
/USER_ID?fields=images
images gives back "an array of objects containing width, height, source each representing the various photo sizes". The result looks like this:
{
"data": [
{
"images": [
{
"height": 1536,
"width": 2048,
"source": "https://fbcdn-sphotos-c-a.akamaihd.net/hphotos-ak-prn1/s2048x2048/65169_XXXXXX_n.jpg"
},
{
"height": 720,
"width": 960,
"source": "https://fbcdn-sphotos-c-a.akamaihd.net/hphotos-ak-prn1/65169_44590146XXXXXXXXn.jpg"
},
{
"height": 540,
"width": 720,
"source": "https://fbcdn-sphotos-c-a.akamaihd.net/hphotos-ak-prn1/s720x720/65169_44XXXXXXX0984540_n.jpg"
},
{
...
},
{
"height": 97,
"width": 130,
"source": "https://fbcdn-photos-a.akamaihd.net/hphotos-ak-prn1/s75x225/65169_44XXXXX_s.jpg"
}
],
}
]
}
Getting the max size of a profile picture
Try with more than 960, i.e 961. You'll get the maximum size of the picture, if available!
/USER_ID?fields=picture.height(961)
Result:
{
"id": "PROFILE_ID",
"picture": {
"data": {
"url": "https://fbcdn-profile-a.akamaihd.net/hprofile-ak-prn1/615962_4486XXXXXXXXX3_601495975_o.jpg",
"width": 1536,
"height": 2048,
"is_silhouette": false
}
}
}

Does github api provide a way to get user's URL?

For example, for user:django, the url I want to retrieve thru github-api is not
https://github.com/django
but
http://www.djangoproject.com/
as shown below in the red ellipse:
The user search api does not return this url in the response.
The Data that returns from the service would be as follows:
https://api.github.com/users/django
{
"public_gists": 0,
"type": "Organization",
"followers": 240,
"login": "django",
"created_at": "2008-10-06T19:43:18Z",
"html_url": "https://github.com/django",
"avatar_url": "https://secure.gravatar.com/avatar/fd542381031aa84dca86628ece84fc07?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-org-420.png",
"company": null,
"email": null,
"blog": "http://www.djangoproject.com/",
"following": 0,
"name": "Django",
"location": "Internet",
"url": "https://api.github.com/orgs/django",
"id": 27804,
"public_repos": 49
}
As you can see, that URL is in the blog field.

Items in the images array of the facebook photo object does not contain a source anymore

We were using photo's from facebook in our application until we noticed today that there was no longer a source field available for the different sizes of the image.
I saw in the facebook documentation that there should be a field "source" for every item in the images array.
images | The 4 different stored representations of the photo |
Requires access_token | array of objects, containing height, width,
and source fields
Here's the json data i get from facebook:
{
"id": "10150916781197589",
"from": {
"name": "Thomas Dekiere",
"id": "641457588"
},
"name": "antwerpen",
"picture": "http://photos-b.ak.fbcdn.net/hphotos-ak-snc7/383569_10150916781197589_641457588_12988491_2098011643_s.jpg",
"source": "http://a2.sphotos.ak.fbcdn.net/hphotos-ak-snc7/s720x720/383569_10150916781197589_641457588_12988491_2098011643_n.jpg",
"height": 720,
"width": 478,
"images": [
{
"width": 1360,
"height": 2048
},
{
"width": 637,
"height": 960
},
{
"width": 478,
"height": 720
},
{
"width": 318,
"height": 480
},
{
"width": 212,
"height": 320
},
{
"width": 180,
"height": 271
},
{
"width": 86,
"height": 130
},
{
"width": 86,
"height": 130
}
],
"link": "http://www.facebook.com/photo.php?fbid=10150916781197589&set=a.10150916780582589.528576.641457588&type=1",
"icon": "http://static.ak.fbcdn.net/rsrc.php/v1/yz/r/StEh3RhPvjk.gif",
"created_time": "2012-04-04T13:42:09+0000",
"position": 1,
"updated_time": "2012-04-04T13:42:19+0000"
}
as you can see, there's no source field in the images array items.
Is this normal behavior now and is the documentation out dated or is this a facebook bug?
There was a bug in the facebook service:
http://developers.facebook.com/bugs/328741343854109
It has been solved :)