javafacebookspringfacebook-graph-apispring-social-facebook

facebook graph api photo post suddenly started giving permission error


I am posting photo on facebook page using facebook graph api 2.2. I am using spring social for the same. The application was working properly out of a sudden the photo posts started giving error few days back saying permission error on posts with a photo . Non photo posts are properly posted on pages.

Facebook facebook = new FacebookTemplate(accessToken);
    Resource resource = null;
    resource = new FileSystemResource("xyz.jpg");   
    facebook.pageOperations().postPhoto(acId, "photos", resource, "TEST POST");

The error that i am receiving from facebook graph api is .

{"error":{"message":"Permissions error","type":"FacebookApiException","code":200,"error_subcode":1366002}}

Solution

  • While using facebook.pageOperations().postPhoto(acId,albumId, resource, "TEST POST");

    The second parameter is supposed to be the Album ID. When I place the call to this method with Album ID of the page, it actually works.

    I think in your earlier code were passing in a name instead of album id.

    Facebook facebook = new FacebookTemplate(accessToken);
    Resource resource = null;
    resource = new FileSystemResource("xyz.jpg"); 
    facebook.pageOperations().postPhoto(acId, "photos", resource, "TEST POST")
    

    Thanks,

    Paul