Identify if the post author is a page or a user? - facebook-graph-api

What is the proper way to identify if the author of a post is a user or a page?
v2.8/OrangeESP/feed?fields=id,from{id,name,link}
"data": [
{
"id": "118067454874491_1584993008181921",
"from": {
"id": "1112315252115029",
"name": "Clara Barranquero",
"link": "https://www.facebook.com/app_scoped_user_id/1112315252115029/"
}
},
I currently use the "from.link" for that and if it is of form
https://www.facebook.com/app_scoped_user_id// then is a User
if it's of from
https://www.facebook.com/ then it is a Page
In v2.4 I could have included from{category} in the response and if that was not empty it meant the author is a Page.

Include a field that´s only available in the Page or User table:
https://developers.facebook.com/docs/graph-api/reference/page/
https://developers.facebook.com/docs/graph-api/reference/user/
Checking for app_scoped_user_id in the link field is not a bad idea though.

Related

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

Facebook Graph Api Get tagged comments

I am trying to gather information about the number of comments from a facebook past that include a tag to a user, i.e. when you type #Joe Bloggs.
I know you can get all comments by either getting using the Comments edge for a post v2.8/[Postid]/comments or by the comment id directly v2.8/[comment-id]
But the message field that is returned is plain text and includes no indication of tags. e.g. something like:
{
"created_time": "2017-02-28T09:31:08+0000",
"from": {
"name": "Fred Bloggs",
"id": "123"
},
"message": "Joe Bloggs look at this",
"id": "1234"
}
Is it possible to get this somehow?
You need to include the field message_tags in your request. It will give you an array of profiles tagged in this comment.

How to get cover photo from a document created in a Facebook group?

I am using the graph API explorer trying to find the photo added as the cover photo of a created document in a facebook group.
I am using the api call graph/v2.8/{group-id}/docs to get all the documents, and that works. However, there are no fields from a single doc stating anything about a cover picture. when I get all the documents I get data such as:
{
"data": [
{
"can_delete": true,
"can_edit": true,
"created_time": "2017-01-22T12:13:39+0000",
"from": {
"name": "name",
"id": "someId"
},
"icon": "https://static.xx.fbcdn.net/rsrc.php/v3/y7/r/8zhNI-VGpiI.png",
"message": "some HTML-formatted message",
"revision": "revNr",
"subject": "subject",
"updated_time": "2017-01-23T10:08:46+0000",
"id": "someDocId"
}
]
}
Maybe it is possible to use the documentId in order to get the cover photo, but I don't seem to find the correct API call. Are there any special permissions I need to have as well? I am only using the user_managed_groups permission.

How to get Facebook posts for og_object or shared url?

Articles from the blogging website get published on multiple Facebook pages and I need to get the list of facebook post urls that contain specific article url.
It is possible to get og_object details by article url using this request:
https://graph.facebook.com/v2.5/?id=http://spoilednyc.com/2015/02/10/16-bucket-list-must-dos-real-new-yorkers&access_token=ACCESS_TOKEN
The result will be:
"og_object": {
"id": "794284920664423",
"description": "New York City has so much to offer beyond the attractions most known to tourists. Want to go off the beaten path, here are some suggestions for you.",
"title": "Beyond the Tourist Attractions: 16 Bucket List Must-Dos for 'Real' New Yorkers",
"type": "article",
"updated_time": "2016-02-19T11:21:26+0000",
"url": "http://spoilednyc.com/2015/02/10/16-bucket-list-must-dos-real-new-yorkers/"
},
"share": {
"comment_count": 0,
"share_count": 15247
},
"id": "http://spoilednyc.com/2015/02/10/16-bucket-list-must-dos-real-new-yorkers"
}
From this point I can find, for example, a list of comments using
https://graph.facebook.com/v2.5/794284920664423/comments/?access_token=Access_Token
Is there a way to get Facebook posts or post-ids by og_object id in a similar way?

facebook group members Bio information

I am interested in retrieving a Facebook group members' Bio information.
I have created an app where I have requested permission of about user_about_me and the app is under review for submission.
I have coded for the app in JSP but it can only select name, gender, last_name, first_name only. It is not selecting the Bio information.
I face the same problem even in the graph API explorer, when I use
{group_ID}/members
I can retrieve list of all group members. But I can not see more details than the following:
"data": [
{
"name": "name",
"administrator": false,
"id": "USER ID"
},
..
When I click on the ID (or enter the ID in the explorer), I can only get the following:
{
"id": "member_ID",
"first_name": "firstname",
"last_name": "lastname",
"link": "https://www.facebook.com/app_scoped_user_id/...",
"name": "name ",
"updated_time": "2015-02-07T10:02:58+0000"
}
This is not showing the Bio information.
when I enter the following:
{member_ID}?fields=bio
I just get
{
"id": "10153223503039309"
}
I will appreciate if someone please identify me the problem. I believe this problem will also solve my code problem, where at the moment I am unable to retrieve the group member's Bio information too.
Is it possible that the problem will be resolved after the app's acceptance, which is under review?
Thanks you very much.
Syed
You can´t just grab more information from the user just because he is a member of some group. You would have to let him authorize your App with the correct permissions in order to get more data.