0

我使用 RestFb 作为 Java 包装器来调用 Facebook 图形 API。我想以管理员身份发布到我的粉丝页面。目前,所有帖子都显示为我的个人帖子。我已使用“manage_pages”作为权限之一获取 access_code。这是我的代码:

public void postOnWall(String wallId, String message, String picture, String link, String linkname, String caption, String description) throws FacebookException {
        facebookClient.publish(wallId+"/feed", FacebookType.class,
                   Parameter.with( "message", message),
                   Parameter.with( "picture", picture), 
                   Parameter.with( "link", link),
                   Parameter.with( "name", linkname),
                   Parameter.with( "caption", caption),
                   Parameter.with( "description", description));
    }

在我的调用方法中:

try {
            FacebookService facebookService = new FacebookService("access_token");
            facebookService.postOnWall("page_id", comment, "image", "link", title, "caption", description);
        } catch (FacebookException e1) {
            e1.printStackTrace();
        }

我已将双引号中的所有参数替换为实际值。还需要什么?

4

1 回答 1

2

要作为页面本身发布,您需要使用页面访问令牌,

要检索它,您需要:

  • 获得manage_pages用户的许可
  • 访问该/me/accounts用户的连接
  • /me/accounts从该调用的结果中获取每个页面的访问令牌
  • 发布到/{page id}/feed使用页面访问令牌
于 2011-10-06T15:41:47.730 回答