This question already has answers here:
Facebook JS SDK's FB.api('/me') method doesn't return the fields I expect in Graph API v2.4+
(4 answers)
Closed 6 years ago.
I use this API to take some notes from facebook page:
https://developers.facebook.com/docs/graph-api/reference/v2.8/user/feed
It returns me object:
"data": [
{
"story": "pdated their profile picture.",
"created_time": "2017-01-13T23:02:10+0000",
"id": "439421442879448_707028796118710"
},
How can I get photo and name of author?
You have to ask for the field:
/me/feed?fields=from
Result:
{
"data": [
{
"from": {
"name": "xxx",
"id": "xxx"
},
"id": "xxx"
},
...
...or to get pictures too:
/me/feed?fields=from{id,name,picture}
For Pages, just replace "me" with the Page ID.
Related
I want to create app for get users' interaction with page. Each users like, comments, share specific page post.
I want to get count of total likes, comments and shares done by each user.
I used Graph API to return page
https://graph.facebook.com/PAGE_ID/feed?fields=id,likes,comments{from},shares
i got results similar to this.
{
"data": [
{
"id": "478412518924513_633895136709583",
"likes": {
"data": [
{
"id": "3696534343199936",
"name": "User Name"
},
{
"id": "576343349495810279",
"name": "User name"
}
],
},
"comments": {
"data": [
{
"from": {
"id": "154e3485900543",
"name": "user name"
},
"id": "633895096709587_633907896708307"
},
{
"from": {
"id": "10202701931494709",
"name": "User anme"
},
"id": "633895096709587_633899590042471"
}
],
}
},
How can i get how many likes,comments made by each user?
There are no endpoints you can get these counts from. This means that you have to aggregate the data yourself, namely
1) Iterating over the Page's Feed:
GET /{Page_ID}/feed?fields=id,created_time,likes{id},comments{from{id}},sharedposts&limit=200
and use the paging info to get the next results
See
https://developers.facebook.com/docs/graph-api/reference/v2.1/page/feed/#read
https://developers.facebook.com/docs/graph-api/reference/v2.1/post#edges
2) Aggregate the resulting data yourself in your application
I forgot to tag a friend as "with—" on a two-photos post. The post got likes and comments so I cannot delete/repost. I tagged the friend on the single photos, but on my wall it has not the "with <friend name>" caption.
If I GET /v2.1/<post-id>/tags:
GET /v2.1/<post-id>/tags
{
"data": [
]
}
where on another post with tagged friends I get:
{
"data": [
{
"id": "<friend-id>",
"name": "<friend-name>"
},
{
"id": "<friend-id>",
"name": "<friend-name>"
},
…
}
Can I tag my friend via Graph API?
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 9 years ago.
Improve this question
[Apologies for poor quality question]
I am trying to pull open graph stories (public) published by my friends about an application. I realize that the typical filtering mechanism for feed (me/home?filter=app_321574327904696) does not work for Open Graph Stories.
Can someone help me find out the API that could filter OG stories for an application (or a keyword)?
Retrieving Open Graph actions is documented here: https://developers.facebook.com/docs/opengraph/using-actions/#read
You need the user_actions:<APP NAMESPACE> permission from the user whose actions you wish to read, then you need to make an API call to /<USER ID>/<APP NAMESPACE>:<ACTION TYPE NAME> to retrieve the actions
For example, to retrieve Pinterest's 'pin' actions posted by a user, you need the user_actions:pinterestapp permission to be granted, then make an API call to /me/pinterestapp:pin
A sample output for me begins:
"data": [
{
"id": "<REMOVED ID>",
"from": {
"name": "<REMOVED NAME>",
"id": "<REMOVED USER ID>"
},
"start_time": "2013-09-11T00:20:15+0000",
"end_time": "2013-09-11T00:20:15+0000",
"publish_time": "2013-09-11T00:20:15+0000",
"application": {
"name": "Pinterest",
"namespace": "pinterestapp",
"id": "274266067164"
},
"data": {
"pin": {
"id": "<REMOVED PIN ID>",
"url": "http://pinterest.com/pin/<REMOVED PIN ID>/",
"type": "pinterestapp:pin",
"title": "TEST"
}
},
"type": "pinterestapp:pin",
"no_feed_story": false,
"likes": {
"count": 0,
"can_like": true,
"user_likes": false
},
"comments": {
"count": 0,
"can_comment": true,
"comment_order": "chronological"
}
},
[...]
How can a facebook app, have access to a social reader's post in the feed? For example, I want to have access to Washington Post's social reader post (when someone else reads an article there and it gets shown up in my news feed) from an app that I am writing. Is it possible to do so, using FQL?
It's easily available in the Graph API (i'll check if it's in FQL)
Basically, either way you'll need to request the user_actions.reads permission from your users. (NB: not user_actions:reads which would be for an app whose namespace is 'reads', for news, music and video apps using the build-in actions there's a special scope)
Then, for the Graph API, just make a call to /USER_ID/news.reads - the response includes the recently read articles from all apps using the built-in 'read' action, example response for my account below:
{
"data": [
{
"id": "REMOVED_ID",
"from": {
"id": "REMOVED_MY_USER_ID",
"name": "REMOVED_MY_NAME"
},
"start_time": "2012-05-10T00:05:10+0000",
"end_time": "2012-05-10T00:05:10+0000",
"publish_time": "2012-05-10T00:05:10+0000",
"application": {
"id": "235586169789578",
"name": "The Independent"
},
"data": {
"article": {
"id": "10150697347986736",
"url": "http://www.independent.co.uk/life-style/food-and-drink/features/the-10-best-scotch-whiskies-1488408.html",
"type": "article",
"title": "The 10 Best Scotch Whiskies"
}
},
"likes": {
"count": 0
},
"comments": {
"count": 0
}
},
.... //more articles
I am trying to retrieve the "Place" field of a Facebook Graph Post object from a Facebook friend. After obtaining an access token with the friends_status and read_stream permissions, I request from the Graph API like so:
http://graph.facebook.com/[user_id]_[post_id]
What is returned are some of the fields described in the Graph API docs for Post:
{
"id": "1164358582_2458311174854",
"from": {
"name": "Joe Blo",
"id": "1164358582"
},
"message": "Is pretty bummed today",
"actions": [
{
"name": "Comment",
"link": "http://www.facebook.com/1164358582/posts/2458311174854"
},
{
"name": "Like",
"link": "http://www.facebook.com/1164358582/posts/2458311174854"
}
],
"type": "status",
"application": {
"name": "Facebook for Android",
"id": "350685531721"
},
"created_time": "2011-11-20T03:23:04+0000",
"updated_time": "2011-11-20T12:12:49+0000",
"comments": {
"data": [
{
"id": "1164358582_2458311174852_2962531",
"from": {
"name": "Sue Candy",
"id": "1056617421"
},
"message": "OMG I'm so sorry!!!",
"created_time": "2011-11-20T03:25:06+0000"
}
],
"count": 1
}
}
This is all fine and dandy, except for the fact that when I see this Post within my Facebook stream, it also shows a location accompanying the post:
9 hours ago near El Reno, OK
I expected the El Reno, OK Place object returned as a field within this Post, but I don't see it.
In the Facebook Graph API Explorer, I've tried enabling almost every permission and I am not seeing any difference in the response (no "Place" field returned). Am I going about this incorrectly?
Not 100% sure but I think you can only get the "place" info if it is of type "checkin". I totally get where you are coming from, I wondered about that myself.
https://developers.facebook.com/tools/
Try the Graph API Explorer Tool if you haven't already looked at it.