Search code examples
javafacebookurlpublish

Publishing URL through java application


When posting a URL on the facebook wall, facebook get URL data and mounts a post with that information. I wonder how do I post to this format by sending an URL using Java, for example using the API restfb (http://restfb.com/) or using graph API or any other way to do this in Java.

Thanks.


Solution

  • Solution:

    var wallPost = {
                message : "Message in post",
                picture: URL_IMAGE,
                link: URL,
                name : POST_NAME,
                description: POST_DESCRIPTION
            };
            FB.api('/me/feed', 'post', wallPost , function(response) {
              if (!response || response.error) {
                     console.log("Error to post");
              }
            });