I'm trying to post a photo on the wall of a friend using RestFB, a Java API for Facebook. I tried various solutions like:

facebookClient.publish(fbu+"/photos/",FacebookType.class,new FileInputStream(pathOrig));

fbu is the Facebook user id of the friend. This code actually posts the photo on my wall!

facebookClient.publish(fbu+"/feed/",FacebookType.class,new FileInputStream(pathOrig),Parameter.with("message",message));

This code posts the message on my friend's wall, but without the photo.

Strangely, it's possible using directly Facebook to upload photos on friends wall, so it should be possible using Graph, in my opinion...

Any clue?

有帮助吗?

解决方案

You can't post a photo on your friends wall. You can, however, upload a photo and tag your friend in it.

According to the Photo Documentation you set the tags on a photo by setting the tags parameter on the graph request, and formatting like so:

[{
    "tag_uid": <fb uid>,
    "x":74,
    "y":62
},
{
    "tag_uid": <fb uid 2>,
    "x":8,
    "y":27
}]

Each object is the has your friend's FBuid and the x and y position of the tag location on the photo.

You can, however, publish a link on your friend's wall to a photo and have the link go off Facebook for them to view it. This is probably not what you're looking to do, but it's an option.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top