简体   繁体   中英

How to limit Facebook Graph API to only posts (not comments or likes) by user without using FQL?

I am trying to query the FB graph API for all of my posts. I would like the result set to only feature items that I've posted on my timeline. Not other users, and not my likes or comments.

The documentation is extremely confusing and most of the knowledge I've gained is through trial and error. To date, the only proposed solutions to this I've found online require the use of FQL (such as in this similar question: Facebook graph api- how to get user feed,with out posts about likes and comment by the user? ) however the FB documentation states that FQL is deprecated and will not be supported in the future so I would like to avoid it. Additionally this is currently structured as a url request and if at all possible, I would like to keep it so.

To date, I've tried:

/[userid]?fields=posts.limit(100).fields( picture, link, created_time, from, message, description, object_id )

which will get me all of my posts with the data fields I require, but it also includes "Likes" and when I "Comment" anywhere - which I don't want.

 /[userid]?fields=feed.limit(100).fields( picture, link, created_time, from, message, description, object_id )

which returns only posts - but also includes posts made by others on my timeline (and I don't want those either).

It seems unclear to me if there is any more robust way to work with these different feed types as documented:

https://developers.facebook.com/docs/graph-api/reference/v2.0/user/feed/

Can anyone tell if there is a way to either limit the "feed" edge to only my posts (not including others posting to my timeline) or filter the "posts" edge to remove the "likes" and "comments"?

Instaead of /feed, you can use /posts.

More info here: https://developers.facebook.com/docs/graph-api/reference/v2.0/user/feed

It's not possible as far as I know to generally apply filters to the Graph API calls, except very little exceptions.

/user/feed is an example ( https://developers.facebook.com/docs/graph-api/reference/v2.0/user/feed/#read ), where you can specify either with=location or filter={stream_filter} .

{stream_filter} in this case is a result of the filter_key field of the following FQL query:

select filter_key, name from stream_filter where uid=me()

Maybe you can try

GET /me/feed?filter=app_2915120374

which should give you the status updates.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM