How to get Facebook posts for og_object or shared url? - facebook-graph-api

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?

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.

Identify if the post author is a page or a user?

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.

Query Group Feed Posts by `created_time`

For a small Facebook Sales Group Monitor I need to query the group's new posts. I've intended to do this via the Graph API, requesting only posts which have been either
created since the last query (created_time) or
updated since the last query (updated_time).
This, however, seems not to be possible.
Omitting all non-date fields, a GET /v2.7/<group-id>/feed request returns the following data:
"data": [
{
"updated_time": "2016-01-12T20:11:02+0000",
"created_time": "2014-09-16T09:55:39+0000",
"id": "552364968142715_789142084465001"
},
{
"updated_time": "1970-01-01T00:16:40+0000",
"created_time": "2016-08-28T19:15:53+0000",
"id": "552364968142715_1183108935068312"
},
{
"updated_time": "1970-01-01T00:16:39+0000",
"created_time": "2016-08-29T14:13:22+0000",
"id": "552364968142715_1183722648340274"
},
{
"updated_time": "1970-01-01T00:16:38+0000",
"created_time": "2016-08-28T09:15:05+0000",
"id": "552364968142715_1182673285111877"
},
...
]
The first entry is from the pinned group-rules post, created in 2014, updated 2016.
The second and fourth entries are both from yesterday, the third post is from today.
All but the first post have updated_time-timestamps close to the UNIX epoch's beginning. With a few exceptions, the value seems to be decreasing by 1 second for every post in the list, even when requesting 100+ posts.
The API Reference for Group feeds states, that the since=<timestamp> query parameter only applies on the updated_time field, which does not help in this case.
Is there any way to filter for or at least sort by the created_time value?
I am running into same problem. It seems currently created_time only apply for Page feed, not Group feed at the moment :(

Facebook Objects API Queries o

I have asked some old questions previously but those were quite misleading. So I decided to delete them and creating this one.
My object has a custom property named say it is portal content. In the Facebook Graph API Explorer data related to this object shown like;
{
"created_time": "2015-11-26T08:42:26+0000",
"title": "Title",
"type": "ns:type",
"data": {
"portalcontent": "portalcontent"
},
"id": "12515125125"
},
{
"created_time": "2015-11-26T08:04:09+0000",
"title": "Title2",
"type": "ns:type",
"id": "412512512512"
},
{
"created_time": "2015-11-25T12:56:03+0000",
"title": "Title3",
"type": "ns:type",
"id": "234124124124"
}
I am trying to query this data using Facebook graph api. But can not fetch just based on the portal content custom property.
So far I tried;
appid/objects?pretty=0&type=ns:type&limit=100&portalcontent=portalcontent
to do so. But it is still fetching all objects.
PS: please pm or comment on question for why you are downvoting it. Provide what else you need that I must put on the question. Downvoting for no reason getting people annoyed.
There's currently no way to filter results other than those described on the respective endpoint's docs.
See
https://developers.facebook.com/docs/graph-api/reference/application/objects/
https://developers.facebook.com/docs/graph-api/using-graph-api/v2.5