Announcement Announcement Module
Collapse
No announcement yet.
Should there be any worries when using the RestTemplate.postForLocation method? Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Should there be any worries when using the RestTemplate.postForLocation method?

    Hi to everyone,

    I started developing with Spring Social. I saw that Spring Social's FacebookTemplate only gets the most important info. Since I want to do more, I started extending it.

    I stroke a stone when I tried to develop the "like" functionality from facebook. I am using the same syntax that you have for the updateStatus:
    Code:
            public void updateStatus(String message) {
    		MultiValueMap<String, String> map = new LinkedMultiValueMap<String, String>();
    		map.set("message", message);
    		publish(CURRENT_USER, FEED, map);
    	}
    	
    	public void updateStatus(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);
    	}
    	
    	public void publish(String object, String connection, MultiValueMap<String, String> data) {
    		MultiValueMap<String, String> requestData = new LinkedMultiValueMap<String, String>(data);
    		restOperations.postForLocation(CONNECTION_URL, requestData, object, connection, accessToken);
    	}
    My code is:
    Code:
            public URI likeThisComment(String commentFacebookId){
    		MultiValueMap<String, String> map = new LinkedMultiValueMap<String, String>();
    //		map.set("message", message);
    		MultiValueMap<String, String> requestData = new LinkedMultiValueMap<String, String>(data);
    		URI locationOfResource = restOperations.postForLocation(CONNECTION_URL, requestData, commentFacebookId, LIKES, accessToken);
    	}
    I can update the status - no problem there, but when I use the same method for "likes", I get "400 Bad Request". When I enter the url in the browser I get:
    Code:
    {
       "data": [
          
       ]
    }
    I have all the privileges, so I should be able to make a like on a comment. I couldn't find anything on the facebook forum, so any suggestion or a link where I can find some sort of explanation what is going wrong would be great.

    Kind Regards,
    Despot
Working...
X