【问题标题】:fetch facebook group using Graph api java使用 Graph api java 获取 facebook 组
【发布时间】:2016-07-22 06:51:55
【问题描述】:

我正在尝试使用 java 中的 restfb 从我的 facebook 帐户获取所有组,我编写了以下代码

JsonObject json = fbClient.fetchObject(userObj.getLong("id") + "/groups", JsonObject.class, Parameter.with("fields", "description,email,name));

当我检查我的 Json 时,我正在检测输出:

{
  "data":  []
}

当我尝试使用 Facebook 图形 Api Explorer 时,我不知道这里发生了什么,它工作正常并显示 Facebook 帐户中可用的所有组。

如果有人可以帮助我。

谢谢

【问题讨论】:

  • 你能展示更多你的代码吗? fbClient 和 userObj 是如何设置的?

标签: java facebook-graph-api restfb facebook-group


【解决方案1】:

您只能获取您管理的群组,并且您必须使用user_managed_groups 权限进行授权。

很可能,您没有管理任何组或访问令牌不包含权限。

【讨论】:

【解决方案2】:

正如这个答案所描述的,您不太可能获得做您想做的事情的许可。

https://stackoverflow.com/a/31043823/1542667

简而言之:Facebook 将不再批准 user_groups 权限 大多数开发者从 2015 年 4 月 30 日开始。

【讨论】:

    【解决方案3】:

    如何在 Java 中使用 RestFB 从 Facebook 群组获取帖子?

    我使用apptoken 在页面中获取帖子,但是当我使用groupeId+"/post" 创建连接时,程序说:

    Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.2.1:exec (default-cli) on project MonitoringFB:
        Command execution failed. Process exited with an error: 1 (Exit value: 1) -> [Help 1]
    
    To see the full stack trace of the errors, re-run Maven with the -e switch.
    Re-run Maven using the -X switch to enable full debug logging.
    
    For more information about the errors and possible solutions, please read the following articles:
    [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException"
    

    这是什么意思?

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2018-12-19
      • 1970-01-01
      • 2020-06-10
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多