How to get activity from my app with Facebook Graph API?

喜你入骨 提交于 2019-12-06 07:14:14

问题


I have an app that uses the Graph API to post activity to a user's timeline, however, I want to be able to display this activity within the app itself (and potentially friends' activity, but that's another issue).

I can't seem to find a way to access my own app's activity though. Poking around, I found this: https://developers.facebook.com/docs/authentication/permissions/#open_graph_perms and tried adding permission for user_actions:NAMESPACE, however I can't seem to get the activity.

I can successfully get video/music activity with the user_actions.video/music permission, and calling /me/music.listens or video.watches, however I can't seem to find a way to get this for my own activity.

For the sake of example, let's say my action is "cook," I have tried:

/me/NAMESPACE:cook
/me/NAMESPACE:cooks
/me/NAMESPACE.cook
/me/NAMESPACE.cooks

But nothing seems to work - am I missing something here?


回答1:


Your app can read any data that it published in without asking for any other permissions.

You read actions from the same URL you posted them to:

if you POSTed your actions to:

POST https://graph.facebook.com/me/yournamespace:cook?access_token=USER_ACCESS_TOKEN

then you read them by GETing:

GET  https://graph.facebook.com/me/yournamespace:cook?access_token=USER_ACCESS_TOKEN

You can read a users friends actions that your app posted too without any additional permissions - you did post it after all, and that user has already auth'd your app. Again, you just GET:

GET  https://graph.facebook.com/USER_ID/yournamespace:cook?access_token=USER_ACCESS_TOKEN


来源:https://stackoverflow.com/questions/9814025/how-to-get-activity-from-my-app-with-facebook-graph-api

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!