I am trying to post a photo on a page using the following:
FacebookClient client = new DefaultFacebookClient(destinationAccessToken);
BinaryAttachment attachment = BinaryAttachment.with(imageName, imageInputStream);
Photo photoResponse = client.publish("/me/photos", Photo.class, attachment);
I get the following response:
{
"error": {
"message":"An unexpected error has occurred. Please retry your request later.",
"type":"OAuthException",
"code":2
}
}
When I use the same code to post to the user's wall, it works fine.
I also tried sending on "/{page id}/photos"with the same result.
Destination access token has permissions manage_pages, photo_upload, publish_actionsand publish_streamamong others.
What am I doing wrong here?
UPDATE:
If I publish to a predefined album using "/{album id}/photos", then it will work. Quote this post on the Facebook developers blog :
https://graph.facebook.com/USER_ID/photos - , . , . .
? - ?
2:
, .
3:
, -, .