How to get attached comment pictures in Facebook with restfb?

330 views Asked by At

I'm having troubles getting the attached image of a comment to a status update in a Facebook page using restfb.

I'm commenting a status update in the page (did by myself) and adding a picture. I'd like to get that picture, but the Comment object returned has always the attachment set to null...here is the code:

JsonObject commentAsObject = FacebookUtils.getCommentAsObject(access_token, commentId);
Comment comment = FacebookUtils.getComment(access_token, commentId);
if (comment.getAttachement() != null)
    //Do something

The commentId is valid, I build the permalink using that ID and it works...and the returned Comment object has all the values, like message OK, but the picture is not present...thus, does restfb return any of this?

Thanks!

1

There are 1 answers

0
Norbert On

The request you build to fetch the comment needs the fields=attachment parameter, because this is field is only returned if explicitly requested.