如何使用Facebook Graph API从我的应用程序获取活动? [英] How to get activity from my app with Facebook Graph API?

查看:120
本文介绍了如何使用Facebook Graph API从我的应用程序获取活动?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个应用程序使用Graph API将活动发布到用户的时间轴上,但是,我希望能够在应用程序本身(可能是朋友的活动,但这是另一个问题)中显示此活动。 p>

我似乎找不到一种访问我自己的应用程序活动的方法。发现这一点: https://developers.facebook.com/docs/authentication / permissions /#open_graph_perms ,并尝试添加user_actions的权限:NAMESPACE,但我似乎无法获得活动。



我可以成功获取视频/音乐活动与user_actions.video/music许可,并调用/me/music.listens或video.watches,但我似乎找不到一种方式来获得这个为我自己的活动。



为了举例,我们的行为是煮,我试过:

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

但似乎没有什么可行的 - 我在这里缺少什么?

解决方案

p>您的应用程序可以读取其发布的任何数据,而无需任何其他权限。



如果您将您的操作发布到:


$,您可以从发布他们的相同URL中读取



b $ b

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

然后您通过GETing阅读:

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

您可以阅读用户的朋友你的应用程序发布的操作没有任何附加的权限 - 你完全发布了,该用户已经知道你的应用程序。再次,您只需GET:

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


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?

解决方案

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

这篇关于如何使用Facebook Graph API从我的应用程序获取活动?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆