I am using Graph Explorer and trying to fetch each individual wall post my friends sent to me on a specific day (my birthday).
My request is for the feed:
https://graph.facebook.com/100000015733365/feed?access_token=xyz&since=7+October+2015
response:
{
"data": [
{
"id": "<post_id_2>",
"from": {
"name": "<name2>",
"id": "<id2>"
},
"story": "<name2> and 69 others wrote on your timeline.",
"story_tags": {
"0": [
{
"id": "<id2>",
"name": "<name2>",
"type": "user",
"offset": 0,
"length": 8
}
],
"37": [
{
"id": "<my_id>",
"name": "<my_name>",
"type": "user",
"offset": 37,
"length": 8
}
],
"13": [
{
"id": "<id3>",
"name": "<name3>",
"type": "user",
"offset": 13,
"length": 9
},
{
"id": "<id4>",
"name": "<name4>",
"type": "user",
"offset": 13,
"length": 9
},
{
"id": "<id5>",
"name": "<name5>",
"type": "user",
"offset": 13,
"length": 9
}
]
},
"privacy": {
"value": "",
"description": "",
"friends": "",
"allow": "",
"deny": ""
},
"type": "status",
"status_type": "wall_post",
"created_time": "2015-10-07T20:43:07+0000",
"updated_time": "2015-10-07T20:43:07+0000",
"is_hidden": false,
"is_expired": false
}
It seems Facebook groups the posts by content, it's okay on my wall (in web browser) but how can I turn off this behavior through the API call?
I cannot find any setting related to this even after I read the API reference thoroughly.
I need these grouped posts one by one because I would like to process them in python, since I cannot achieve this with the graph explorer I think it's okay to not post python code right now.
An alternative would be to expand this 'story' into a list of individual posts but this is well hidden according to the documentation.
Any help is appreciated, thanks!
Related
Back years ago I used the Facebook Graph API to gather users friend photos and likes for those photos. However, that was back when the API was v2.11 or v4 or something like that. Now at version 12, my code no longer works. I've tried getting the same data I once did back using their Graph API but I have no success in doing so.
I have the JSON below to show what data I used to get and which I am now trying to get again. Note that no links within the JSON will work - this is only an example.
Basically Its gathering my friends photos by their ID in ascending order and anyone who has liked those photo.
The call I would normally make to get this data was:
https://graph.facebook.com/[user id]/picture?type=large&width=720&height=720
Are you still able to get other friends photos as well or has that been stopped now? Do your friends have to join your Facebook app in order to gather photo data like this from them?
{
"data": [{
"created_time": "2017-12-08T18:57:53+0000",
"likes": {
"data": [{
"name": "Bill Gates",
"id": "9485030985688759"
}, {
"name": "Bob Barker",
"id": "1944578789965397"
}, {
"name": "Steve Jobs",
"id": "4423564564766486"
}, {
"name": "James Bond",
"id": "1027785445557557"
}, {
"name": "Bart Simpson",
"id": "10214564574448423"
}, {
"name": "Lisa Simpson",
"id": "16845876543328680"
}
],
"paging": {
"cursors": {
"before": "MTAyMHISTeY5MjYyOTE2NzQZD",
"after": "MTUzODUYTREEewQ5OTA2MwZDZD"
}
}
},
"images": [{
"height": 960,
"source": "https:\/\/scontent.xx.fbcdn.net\/v\/t1.0-9\/243633743_10101633995322638_8617605831554312755_n.jpg?oh=d4ca434j6nrn4332d723981a8b3e7137e4&oe=5B044D79",
"width": 720
}, {
"height": 800,
"source": "https:\/\/scontent.xx.fbcdn.net\/v\/t1.0-0\/p600x600\/24909743_10345633995322638_8614363524112755_n.jpg?oh=60e21c107fe171898452tre338a4c918&oe=5B479FB6",
"width": 600
}, {
"height": 640,
"source": "https:\/\/scontent.xx.fbcdn.net\/v\/t1.0-0\/p480x480\/24909743_1013473995322638_861760343422414112755_n.jpg?oh=5302f74db20c780436nGddn16461f70&oe=5Bttr48C",
"width": 480
}
],
"id": "10101633993437538"
}, {
"created_time": "2017-06-05T21:14:28+0000",
"likes": {
"data": [{
"name": "Amy Someone",
"id": "453437546783720"
}, {
"name": "Mike LG",
"id": "181855436553221"
}, {
"name": "Homer Simpson",
"id": "194335643226397"
}, {
"name": "Bart Simpson",
"id": "194332353226397"
}
],
"paging": {
"cursors": {
"before": "MTAyMTMRFeht5zg3MzM3MjAZD",
"after": "MTUzODcfrhreOTQ5OTA2MwZDZD"
}
}
},
"images": [{
"height": 1440,
"source": "https:\/\/scontent.xx.fbcdn.net\/v\/t31.0-8\/18839799_10101467545354528_4346343h5628628521_o.jpg?oh=31297frt35y6e892c0807dad0345b58eb&oe=5B157345",
"width": 800
}, {
"height": 1296,
"source": "https:\/\/scontent.xx.fbcdn.net\/v\/t31.0-8\/p720x720\/18839799_10101417914904528_4346353536428628521_o.jpg?oh=809bb29a5b55e222411a014c8392eea2&oe=5B47D7B8",
"width": 720
}
],
"id": "10134664346528"
}
]
}
As a test I sent my wife a request to be a tester and she approved it but I still can not even pull data from her account?
As you see it just has my friend count and nothing more.
I also made sure it accepted my wife as a tester and it looks like it has:
But that does have a debug message saying:
I want to get my statues from facebook api.
for example:
I post a status on my facebook page:
I love apple.
I need to fetch the data.
I used facebook api.
FB.api('/me/feed', function(response)
{
//do my process
}
however, the data I get is in this format
data": [
{
"id": "*",
"from": {
"name": "*",
"id": "*"
},
"story": "* is now friends with \u674e\u7490 and \u9ec4\u68ee\u6d2a.",
"story_tags": {
"0": [
{
"id": "*",
"name": "****",
"offset": 0,
"length": 9,
"type": "user"
}
],
"30": [
{
"id": "100003483506950",
"name": "\u674e\u7490",
"offset": 30,
"length": 2,
"type": "user"
}
],
"37": [
{
"id": "100008056628095",
"name": "\u9ec4\u68ee\u6d2a",
"offset": 37,
"length": 3,
"type": "user"
}
]
},
"privacy": {
"value": ""
},
"type": "status",
"status_type": "approved_friend",
"created_time": "2014-03-23T02:10:33+0000",
"updated_time": "2014-03-23T02:10:33+0000"
},
the things are all about friends approvment, but what I want is my status.
How should I get these information?
Thank you very much.
Chao
The edge {user_id}/feed will return everything that user has done. You can filter down the information returned by adding fields to select what data you want returned.
me/feed?fields=status_type
The status_type argument will return you which type of update it was and you can use that to filter out the updates you don't want.
You can also play around with the arguments at https://developers.facebook.com/tools/explorer/
{
"id": "11882030_4952296803730",
"from": {
"name": "xxx",
"id": "11882030"
},
"message": "test",
"picture": "https://fbcdn-photos-a.akamaihd.net/hphotos-ak-ash4/408410_4952294483672_298434229_s.jpg",
"link": "https://www.facebook.com/photo.php?fbid=4952294483672&set=pcb.4952296803730&type=1&relevant_count=2",
"icon": "https://fbstatic-a.akamaihd.net/rsrc.php/v2/yx/r/og8V99JVf8G.gif",
"actions": [
{
"name": "Comment",
"link": "https://www.facebook.com/11882030/posts/4952296803730"
},
{
"name": "Like",
"link": "https://www.facebook.com/11882030/posts/4952296803730"
}
],
"privacy": {
"description": "Friends",
"value": "ALL_FRIENDS",
"friends": "",
"networks": "",
"allow": "",
"deny": ""
},
"place": {
"id": "471607792876974",
"name": "TTT",
"location": {
"street": "",
"zip": "",
"latitude": x,
"longitude": x
}
},
"type": "photo",
"status_type": "mobile_status_update",
"object_id": "4952294483672",
"application": {
"name": "Facebook for iPhone",
"namespace": "fbiphone",
"id": "6628568379"
},
"created_time": "2013-01-17T01:29:59+0000",
"updated_time": "2013-01-17T01:29:59+0000",
"comments": {
"count": 0
}
}
As above, I posted a status with two photos. I can get the first photo's thumb URL in picture and the relevant link & count information in link.
But how can I get each photo's specific URL?
FQL often provides more information than Graph API. You have to use the attachment parameter of the stream FQL table to get all the attached photos.
SELECT attachment FROM stream
WHERE source_id = me()
AND post_id="11882030_4952296803730"
Result:
{
"data": [
{
"attachment": {
"media": [
{
"href": "https://www.facebook.com/photo.php?fbid=471082296...",
"alt": "",
"type": "photo",
"src": "https://fbcdn-photos-a.akamaihd.net/hphotos-ak-ash3/5826...",
"photo": {
"aid": "4391039135",
"pid": "439104482145",
"fbid": 471507,
"owner": 102832,
"index": 1,
"width": 485,
"height": 172,
"images": [
{
"src": "https://fbcdn-photos-a.akamaihd.net/hph...",
"width": 130,
"height": 46
}
]
}
}
],
"name": "",
"caption": "",
"description": "",
"properties": [
],
"icon": "https://fbstatic-a.akamaihd.net/rsrc.phpjk.gif",
"fb_object_type": "album",
"fb_object_id": "4391044992857139135"
},
{
... //Photo 2
}
}
]
}
Based on Stéphane Bruckerts answer; you're after attachments. So I'd recommend simply requesting the attachments field in your graph request.
Although this question is a few years old, it still comes up when searching for this topic.
Facebook (Meta) Graph API has changed. Current Facebook (Meta) Graph API is version 13.0.
The best endpoint I found was to use the "/feed" URI slug, with "fields=attachments". Simply cURL / GET:
https://graph.facebook.com/v13.0/$PAGEID/feed?access_token=$AUTHTOKEN&fields=attachments,full_picture,id,message,story
Reference: https://developers.facebook.com/docs/graph-api/reference/v13.0/page/feed
For research purposes I need to get all wall posts of the European Commission's Facebook page. I tried it trough this link, but I couldn't get access: http://graph.facebook.com/EuropeanCommission/posts
Is there any chance I can get a list of all posts ever published by the Commission? Or do I need to hand-copy-and-paste them from the timeline? Comments are not needed.
I just tried in the API Explorer tool and I got the list of posts with pagination links too:
http://developers.facebook.com/tools/explorer?method=GET&path=EuropeanCommission%2Fposts
{
"data": [
{
"id": "107898832590939_396059463745799",
"from": {
"name": "European Commission",
"category": "Government organization",
"id": "107898832590939"
},
"picture": "http://photos-f.ak.fbcdn.net/hphotos-ak-prn1/523856_348222705225216_107898832590939_963377_101027267_s.jpg",
"link": "http://www.facebook.com/notes/european-commission/news-update-2-4-march-2012-by-elections-myanmar-conviasa-added-to-eu-blacklist-v/396059463745799",
"name": "News update 2-4 March 2012: By-elections Myanmar, Conviasa added to EU blacklist, vehicle registration easier and more.",
"description": "\nMonday 2 April: Catherine Ashton congratulates the Government and people of Myanmar on the conduct of the by-elections\n \n\nMyanmar – Pagodas in Bagan\n \n...",
"icon": "http://static.ak.fbcdn.net/rsrc.php/v1/yY/r/1gBp2bDGEuh.gif",
"actions": [
{
"name": "Comment",
"link": "http://www.facebook.com/107898832590939/posts/396059463745799"
},
{
"name": "Like",
"link": "http://www.facebook.com/107898832590939/posts/396059463745799"
}
],
"type": "link",
"application": {
"name": "Notes",
"id": "2347471856"
},
"created_time": "2012-04-04T13:06:58+0000",
"updated_time": "2012-04-05T07:54:16+0000",
"likes": {
"data": [
{
"name": "EU Law and Publications",
"category": "Media/news/publishing",
"id": "218434258171162"
}
],
"count": 1
},
"comments": {
"data": [
{
"id": "107898832590939_396059463745799_5180327",
"from": {
"name": "Ivan Burrows",
"id": "1119361344"
},
"message": "# The European Parliament\n\nWhen do we get ours?\n\nIt seems you have finally managed to get an increase in something.\n\n40\u0025 increase in suicides in Greece.\n\nTheir blood is on your hands.\n\nhttp://www.bbc.co.uk/news/world-europe-17621131",
"created_time": "2012-04-05T07:54:16+0000"
}
],
"count": 1
}
},
{
"id": "107898832590939_424622557555230",
"from": {
"name": "European Commission",
"category": "Government organization",
"id": "107898832590939"
},
"message": "Marie Therese Vella gets a fresh start thanks to ESF-funded training for people over 40. Have a look at how she did it. Are you planning a career change? Are you currently unemployed? Are you aware of the channels available to you to get help? http://bit.ly/HVaLXZ",
"picture": "http://external.ak.fbcdn.net/safe_image.php?d=AQBVJqYwG1_uazFM&w=90&h=90&url=http\u00253A\u00252F\u00252Fec.europa.eu\u00252Fesf\u00252FBlobServlet\u00253Fmode\u00253DvideoPhoto\u002526videoId\u00253D2491\u002526cnt\u00253D313333967",
"link": "http://bit.ly/HVaLXZ",
"name": "Funding - Getting a fresh start",
"caption": "ec.europa.eu",
"icon": "http://static.ak.fbcdn.net/rsrc.php/v1/yD/r/aS8ecmYRys0.gif",
"actions": [
{
"name": "Comment",
"link": "http://www.facebook.com/107898832590939/posts/424622557555230"
},
{
"name": "Like",
"link": "http://www.facebook.com/107898832590939/posts/424622557555230"
}
],
"type": "link",
"created_time": "2012-04-04T11:32:32+0000",
"updated_time": "2012-04-04T12:24:45+0000",
"shares": {
"count": 11
},
"likes": {
"data": [
{
"name": "Stefanija Stoimenovska",
"id": "100000025178728"
}
],
"count": 28
},
"comments": {
"data": [
{
"id": "107898832590939_424622557555230_5762457",
"from": {
"name": "Ehtesham Mallick",
"id": "100001067328472"
},
"message": "I wish some training in Laws especially from European countries and prefer training and distance learning about Human rights under the chartered of UNO",
"created_time": "2012-04-04T12:24:45+0000"
}
],
"count": 1
}
}
],
"paging": {
"previous": "https://graph.facebook.com/EuropeanCommission/posts?limit=2&format=json&since=1333544818&__previous=1",
"next": "https://graph.facebook.com/EuropeanCommission/posts?limit=2&format=json&until=1333539151"
}
}
In the facebook Graph API. the actual message of the object appears as "message": or "story":
Example:
{
"id": "148550335191249_236850319694583",
"from": {
"name": "Sinners Highway",
"category": "Musician/band",
"id": "148550335191249"
},
"story": "Sinners Highway edited their Biography and Band Interests.",
"story_tags": {
"0": [
{
"id": 148550335191249,
"name": "Sinners Highway",
"offset": 0,
"length": 15
}
]
},
"type": "status",
"created_time": "2011-09-02T21:49:50+0000",
"updated_time": "2011-09-02T21:49:50+0000",
"comments": {
"count": 0
}
},
and this one:
{
"id": "148550335191249_258570210855927",
"from": {
"name": "Sinners Highway",
"category": "Musician/band",
"id": "148550335191249"
},
"message": "LETS GET ROCKIN'! ",
"picture": "http://platform.ak.fbcdn.net/www/app_full_proxy.php?app=123966167614127&v=1&size=z&cksum=81c39517d99ba86af6a77df2c4879810&src=http\u00253A\u00252F\u00252Fstatic.bandsintown.com\u00252Fimages\u00252Ffacebook\u00252Fpromote\u00252Fnew-date.png",
"link": "http://bnds.in/q0cSbN",
"name": "Sinners Highway \u0040 The Grange in Nottingham, United Kingdom",
"caption": "Sunday, November 27, 2011 at 6:00pm",
"properties": [
{
"name": "Tickets",
"text": "http://bnds.in/nqft0W",
"href": "http://bnds.in/nqft0W"
},
{
"name": "More Tour Dates",
"text": "http://bnds.in/oZ6VTg",
"href": "http://bnds.in/oZ6VTg"
}
],
"type": "link",
"application": {
"name": "Bandsintown",
"canvas_name": "concertsbybit",
"namespace": "concertsbybit",
"id": "123966167614127"
},
"created_time": "2011-10-21T17:44:12+0000",
"updated_time": "2011-10-21T20:01:31+0000",
},
From what I can tell its completely random whether it is a message or a story.
Does anybody know where and when the story attribute is used and why?
Well from those two examples, the noticeable difference is that the story was an activity that was auto-posted about something the band did on facebook (editing their profile), whereas the message was something that someone has posted on the page wall.