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:
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).
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);
}
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);
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);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.