Announcement Announcement Module
Collapse
No announcement yet.
facebook comment with image Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • facebook comment with image

    Hi,

    I have done to post a comment into the facebook wall using this code

    "Facebook facebook = new FacebookTemplate(usersocial.getAccesstoken());
    FacebookLink fl=new FacebookLink(link, domainname, caption,description);"


    But now i want to look up a image also.

    so, i done this way but it gives error message

    "Facebook facebook = new FacebookTemplate(usersocial.getAccesstoken());
    MultiValueMap<String, String> parts = new LinkedMultiValueMap<String, String>();
    parts.set("message", "praveen");
    parts.set("picture","http://socialtv.s3.amazonaws.com/1738***");
    parts.set("link","http://localhost:8080/*****");
    parts.set("name","kumar");
    parts.set("caption","me");
    parts.set("description","yes");

    facebook.post(usersocial.getProvideruserid(),"",pa rts);"

    POST request for "https://graph.facebook.com/1670253973/" resulted in 400 (Bad Request); invoking error handler

    How to resolve this

    Please help me...

  • #2
    You're posting to the wrong place endpoint...in your code (parts setup clipped out for brevity):

    Code:
    facebook.post(usersocial.getProvideruserid(),"",parts);
    The post() method takes 3 arguments:
    1. The object
    2. The connection
    3. The data to post

    Here you've specified the user ID as the object and nothing as that connection. Therefore you're attempting to post that data to the user object (which isn't allowed). Assuming that you want to post that data to the user's wall (aka, "feed"), then what you should do is this:

    Code:
    facebook.post(usersocial.getProvideruserid(),"feed",parts);
    And, then assuming that the access token has been granted publish authority to the user's feed, this should work.

    Comment


    • #3
      Hi habuma

      Thank's for replay to me..

      I resolved the above problem with u r sojation.

      and now i have one mere challange , when i post the comment into the facebook wall to get replay comments of that comment
      how will it do...

      Please help me.

      Thank you

      praveen

      Comment


      • #4
        Hi habuma

        Thank's for replay to me..
        above problem i resolved some...

        String comment = facebook.publish(uid,"feed",parts);
        FacebookTemplate ft=new FacebookTemplate(usersocial.getAccesstoken());
        Comment commentdata = ft.commentOperations().getComment("1670253973_2771 351577531");

        in this commentdata only i posted message given how to get that message replays....

        please help me...

        Thank'you

        praveen

        Comment


        • #5
          To be clear on terminology:
          - The thing you post to a wall with facebook.publish(uid, "feed", parts) is called a Post
          - When someone replies to a Post, it is called a Comment

          So, in the 3 lines of code you share above, you create a Post in the first line and then in the third line appear to retrieve a comment with a hard-coded ID. (In between you construct a new FacebookTemplate for reasons I do now know.) Where did you get that ID? Are you sure that it is a comment or is it the ID of the Post you created in line 1?

          If you want to get the comments on a Post (which is what I think you want), then the following will work:

          Code:
          List<Comment> comments = facebook.commentOperations().getComments(postId);
          Again, I think part of the confusion here is in your use of the terminology. You are calling things on a wall comments and also wanting to fetch comments on those comments...which isn't correct. You "Post" to a wall and then can "Comment" on a Post.

          Comment


          • #6
            i resolved the above problem with this way

            FacebookTemplate ft=new FacebookTemplate(usersocial.getAccesstoken());
            List<Comment> replays = ft.commentOperations().getComments(commentid);

            how will do this all the process in twitter

            Comment

            Working...
            X