Spring Social Facebook - 发布/发布 API 详细信息

发布于 2024-12-21 04:36:28 字数 618 浏览 2 评论 0 原文

我一直在研究 Spring Social Facebook 的 publish(objectId, connectionName, data) API,但不确定该 API 的用法(遗憾的是,由于缺乏 javadocs!)。有人能给我提供 API 的全面示例用法吗?

我想做的是在用户墙上发布一个故事,类似于下面的快照:

在此处输入图像描述

如何是否应该使用 publish() API 来执行相同的操作?非常感谢任何帮助!

另外,我需要我的帖子有额外的操作(除了点赞、评论之外)。

I have been looking into Spring Social Facebook's publish(objectId, connectionName, data) API, but am not sure of the usage of this API (sadly, due to lack of javadocs!). Can someone point me to a comprehensive sample usage of the API, please?

What I am looking to do is publish a story on a user's wall, similar to the below snapshot:

enter image description here

How should the publish() API be used to do the same? Any help is highly appreciated!

Also, I need my post to have additional actions (apart from Like, Comment).

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

故人如初 2024-12-28 04:36:29

您给出的链接已经有很多方法文档。

查找一个 publish(objectId, connectionName, data) 流程的示例 此处

另请参阅 github-SpringSource 用于其他操作,包括 publish(objectId, connectionName, data)

更新:

您可能会从此方法中获得一些帮助:

public void postToWall(String message, FacebookLink link) {
    MultiValueMap<String, String> map = new LinkedMultiValueMap<String, String>();
    map.set("link", link.getLink());
    map.set("name", link.getName());
    map.set("caption", link.getCaption());
    map.set("description", link.getDescription());
    map.set("message", message);
    publish(CURRENT_USER, FEED, map);
}

The link given by you already having a lot documentation for method.

Find one example with flow of publish(objectId, connectionName, data) here

Also see many examples for at github-SpringSource for additional actions including publish(objectId, connectionName, data).

Update:

You might get some help from this method:

public void postToWall(String message, FacebookLink link) {
    MultiValueMap<String, String> map = new LinkedMultiValueMap<String, String>();
    map.set("link", link.getLink());
    map.set("name", link.getName());
    map.set("caption", link.getCaption());
    map.set("description", link.getDescription());
    map.set("message", message);
    publish(CURRENT_USER, FEED, map);
}
守望孤独 2024-12-28 04:36:29

这是我最终能弄清楚的:

MultiValueMap<String, String> map = new LinkedMultiValueMap<String, String>();
map.set("link", linkUrlString);
map.set("name", "Link Heading");
map.set("caption", "Link Caption");
map.set("description", "Loooooo....ng description here");
map.set("message", "hello world");

// THE BELOW LINES ARE THE CRITICAL PART I WAS LOOKING AT!
map.set("picture", "http://www.imageRepo.com/resources/test.png"); // the image on the left
map.set("actions", "{'name':'myAction', 'link':'http://www.bla.com/action'}"); // custom actions as JSON string

publish(userIdToPostTo, "feed", map);

Here's what I could finally figure out:

MultiValueMap<String, String> map = new LinkedMultiValueMap<String, String>();
map.set("link", linkUrlString);
map.set("name", "Link Heading");
map.set("caption", "Link Caption");
map.set("description", "Loooooo....ng description here");
map.set("message", "hello world");

// THE BELOW LINES ARE THE CRITICAL PART I WAS LOOKING AT!
map.set("picture", "http://www.imageRepo.com/resources/test.png"); // the image on the left
map.set("actions", "{'name':'myAction', 'link':'http://www.bla.com/action'}"); // custom actions as JSON string

publish(userIdToPostTo, "feed", map);
物价感观 2024-12-28 04:36:29

就像上面的答案,但我使用帖子作为我的解决方案。请参阅:

MultiValueMap<String, String> map = new LinkedMultiValueMap<String, String>();
        map1.set("link", "https://www.facebook.com/profile.php?id=100006216492034");
        map1.set("name", "Project Test Post to Group");
        map1.set("caption", "Please ignore this Post");
        map1.set("description", "YOLO here is my discription, Please ignore this post");
facebook.post("userId or GroupID", "feed", map);

Like above answer but I use post for my solution. See this:

MultiValueMap<String, String> map = new LinkedMultiValueMap<String, String>();
        map1.set("link", "https://www.facebook.com/profile.php?id=100006216492034");
        map1.set("name", "Project Test Post to Group");
        map1.set("caption", "Please ignore this Post");
        map1.set("description", "YOLO here is my discription, Please ignore this post");
facebook.post("userId or GroupID", "feed", map);

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文