Facebook API-检查用户是否已被暂停或已停用其个人资料 [英] Facebook API - Check if a user is suspended or has deactivated his profile

查看:142
本文介绍了Facebook API-检查用户是否已被暂停或已停用其个人资料的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

目标:给定一个Facebook别名或ID,以检查以下哪一项是正确的:

  1. 用户已被Facebook暂停
  2. 用户已停用其个人资料
  3. 用户个人资料存在,并且既未暂停也未停用

对我而言,确定案例1(暂停)是否为真对我尤为重要,因为案例1表示用户可能有可疑之处.

我观察到在已知的已暂停帐户上调用graph.facebook.com/username或graph.facebook.com/id会返回

{
   "error": {
      "message": "(#803) Some of the aliases you requested do not exist: kamran.haider.5494360",
      "type": "OAuthException",
      "code": 803
   }
}

在已知已停用帐户的情况下,它会返回

{
   "error": {
      "message": "Unsupported get request.",
      "type": "GraphMethodException",
      "code": 100
   }
}

问题:

  1. 可以假设上述观察总是成立吗?即,对于任何已暂停的帐户,调用返回代码为803的"OAuthException",对于任何已停用的帐户,调用返回代码为100的"GraphMethodException"
  2. 在其他情况下,调用graph.facebook.com/username或graph.facebook.com/id会返回这两个异常吗?
  3. 是否有更好的方法(假设以上是有效的方法)来实现目标(尤其是确定是否已暂停)?

我同时浏览了文档和网络,但没有提及. 任何帮助将不胜感激!

解决方案

  1. 可以假定上述观察总是成立吗?即,对于任何已暂停的帐户,调用返回代码为803的"OAuthException",对于任何已停用的帐户,调用返回代码为100的"GraphMethodException"

    我认为您只能检查"OAuthException",这意味着由于某些可能的原因(在下一个答案中)您将无法访问该用户

  2. 在其他情况下,调用graph.facebook.com/username或graph.facebook.com/id会返回这两个异常吗?

    • 用户已阻止您的应用
    • 用户已在此处
    • 用户已停用其帐户
    • 用户已删除其帐户

  3. 是否有更好的方法(假设以上是有效的方法)来实现目标?

    我认为OAuthException-足够,因为我不希望您与停用/暂停的用户和其他用户建立俱乐部.您只想检查是否可以访问该特定用户.

Goal: Given a facebook alias or an id, to check which of the following is true:

  1. User is suspended by Facebook
  2. User has deactivated his profile
  3. User profile exists and is neither suspended not deactivated

It is especially important for me to identify whether case 1 (suspension) is true, since case 1 would be an indication that the user is potentially suspicious.

I observed that calling graph.facebook.com/username or graph.facebook.com/id on a known suspended account returns

{
   "error": {
      "message": "(#803) Some of the aliases you requested do not exist: kamran.haider.5494360",
      "type": "OAuthException",
      "code": 803
   }
}

while in the case of a known deactivated account, it returns

{
   "error": {
      "message": "Unsupported get request.",
      "type": "GraphMethodException",
      "code": 100
   }
}

Questions:

  1. Is it okay to assume that the above observation always holds? i.e. for any suspended account the call returns "OAuthException" with a code of 803 and for any deactivated account the call returns "GraphMethodException" with code 100 ?
  2. In what other cases does calling graph.facebook.com/username or graph.facebook.com/id return these 2 exceptions ?
  3. Is there a better way (assuming the above is a valid way) to accomplish the goal (especially of identifying if it is suspended)?

I have looked at both the docs and on the web, but found no mention about this. Any help would be appreciated !!

解决方案

  1. Is it okay to assume that the above observation always holds? i.e. for any suspended account the call returns "OAuthException" with a code of 803 and for any deactivated account the call returns "GraphMethodException" with code 100 ?

    I think you can just check for "OAuthException"- and that would imply that you cannot access this user due to some possible reasons (in the next answer)

  2. In what other cases does calling graph.facebook.com/username or graph.facebook.com/id return these 2 exceptions ?

    • User has blocked your app
    • User has disabled all platform apps in their privacy settings, from here
    • User has deactivated their account
    • User has deleted their account

  3. Is there a better way (assuming the above is a valid way) to accomplish the goal?

    I think OAuthException- is enough, since I dont think you want to club the deactivated/suspended and other users. You just want to check if you can access this particular user or not.

这篇关于Facebook API-检查用户是否已被暂停或已停用其个人资料的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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