替换旧的GetAppUsers调用查看使用我的应用程序的用户的朋友? [英] Replacement for old GetAppUsers call to see a user's friends who use my application?

查看:85
本文介绍了替换旧的GetAppUsers调用查看使用我的应用程序的用户的朋友?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在旧的REST API中有一个非常有用的调用是 Friends.getAppUsers 。此调用返回正在使用应用程序的所有朋友。遗憾的是,这不在 Open Graph API中。有一个很好的Stack Overflow帖子,关于它, Facebook的Friends.getAppUsers'使用Graph API

One immensely useful call in the old REST API is Friends.getAppUsers. This call returns all your friends that are using an application. Sadly, this is not in the Open Graph API. There is a good Stack Overflow post about it, Facebook 'Friends.getAppUsers' using Graph API.

然而,可以使用Graph API使 FQL 调用,可以在 Graph API资源管理器

However, it is possible to use the Graph API to make FQL calls as can be seen here in the Graph API explorer.

我以为可能使用C#SDK进行以下调用: p>

I thought that maybe I could make the following call using the C# SDK:

fb.GetAsync("fql/?q=SELECT uid,username, is_app_user FROM user WHERE uid IN(SELECT uid2 FROM friend WHERE uid1 = me()) AND is_app_user=1");

但是,这返回一个错误。有没有办法解决使用现有C#SDK缺少 GetAppUsers 调用?

However, this returned an error. Is there a way to work around the lack of the GetAppUsers call using the existing C# SDK?

推荐答案

user.isAppUser的替换API调用是简单的调用 / me /?fields = installed
这也适用于用户的朋友,所以通过扩展它替代 friends.getAppUsers

The replacement API call for users.isAppUser is a simple call to /me/?fields=installed This also works for a user's friends so by extension it's a replacement for friends.getAppUsers.

我尝试过这两个应用程序访问令牌和常规用户访问令牌。
进行API调用 / {user id} / friends?fields = installed - 返回如下所示:

I tried this both with the App Access Token and a regular User Access token. Make an API call to /{user id}/friends?fields=installed - The return looks like this:

{
  "data": [
    {
      "id": "{FRIEND_UID_1}"
    }, 
    {
      "id": "{FRIEND_UID_2}"
    }, 
    // etc...
    {
      "installed": true, 
      "id": "{FRIEND_UID_X}"
     }

// SNIP

//SNIP

您可以使用安装的的存在或缺少therof:true 以确定哪个用户的朋友使用您的应用程序。

You can use the presence, or lack therof, of the installed:true to determine which of the user's friends use your app.

如果由于某种原因不适合您;您的应用程序在您自己的数据库中是否已经有用户列表?您只需检索用户的完整的朋友列表,并将其与您自己的应用程序的用户记录进行比较。

If that doesn't work for you for some reason; won't you already have a list of uids of users of your app in your own database? You could just retrieve the user's full list of friends and compare it to your own records of who's using your app.

这篇关于替换旧的GetAppUsers调用查看使用我的应用程序的用户的朋友?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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