如何使用Java创建带照片的facebook事件(png或jpg)

时间:2011-09-02 03:38:15

标签: java facebook facebook-graph-api

如何使用Java创建带有照片的facebook事件(png或jpg)

是否有人可以分享范围和价值

非常感谢。

当我阅读graph-api文档时,我仍然无法弄清楚范围。

1 个答案:

答案 0 :(得分:0)

只需使用RestFB即可。以下示例取自网站上真正优秀的文档:

// Publishing an image to a photo album is easy!
// Just specify the image you'd like to upload and RestFB will handle it from there.
FacebookClient facebookClient = new DefaultFacebookClient(MY_ACCESS_TOKEN);
FacebookType publishPhotoResponse = facebookClient.publish("me/photos", FacebookType.class,
  BinaryAttachment.with("cat.png", getClass().getResourceAsStream("/cat.png")),
  Parameter.with("message", "Test cat"));

out.println("Published photo ID: " + publishPhotoResponse.getId());