-1

I had downloaded restFB 2.0.0 for java it was working fine before Facebook scandal. Basically I had to retrieve some traffic information from a page. It was working fine last month but not I'm having this error

Caused by: com.restfb.exception.FacebookOAuthException: Received Facebook error response of type OAuthException: (#10) To use 'Page Public Content Access', your use of this endpoint must be reviewed and approved by Facebook. To submit this 'Page Public Content Access' feature for review please read our documentation on reviewable features: https://developers.facebook.com/docs/apps/review. (code 10, subcode null)
 at com.restfb.exception.generator.DefaultFacebookExceptionGenerator$DefaultGraphFacebookExceptionMapper.exceptionForTypeAndMessage(DefaultFacebookExceptionGenerator.java:174)
 at com.restfb.exception.generator.DefaultFacebookExceptionGenerator.throwFacebookResponseStatusExceptionIfNecessary(DefaultFacebookExceptionGenerator.java:59)
 at com.restfb.DefaultFacebookClient.makeRequestAndProcessResponse(DefaultFacebookClient.java:987)
 at com.restfb.DefaultFacebookClient.makeRequest(DefaultFacebookClient.java:909)
 at com.restfb.DefaultFacebookClient.makeRequest(DefaultFacebookClient.java:871)
 at com.restfb.DefaultFacebookClient.fetchObject(DefaultFacebookClient.java:408)
 at gis_map.Facebook.getPostFromComplaintsSystem(Facebook.java:217)

here is the code that I've used before to retrieve info from the page

    public int getElementMauritiusTrafficAlert() throws ParseException {
    FacebookClient fbClient = new DefaultFacebookClient(accessToken);
    Page page = fbClient.fetchObject("1368529399900469", Page.class);

    Connection<Post> postFeed = fbClient.fetchConnection(page.getId() + "/feed", Post.class, Parameter.with("since", Today));
    for (List<Post> postPage : postFeed) {
        for (Post aPost : postPage) {

            list.add(aPost.getMessage() + "\n" + aPost.getCreatedTime());

        }

    }
    return list.size();
}

I really don't know what is going wrong with this API, my whole application won't start because of this. I tried to comment the function where I've used the api but it is still throwing this error. Any help please !

Valek
  • 75
  • 2
  • 6

1 Answers1

0

Your app needs the "Page Public Content Access" feature as the error message says. Has nothing to do with RestFB.

https://developers.facebook.com/docs/apps/review/feature#reference-PAGES_ACCESS

Norbert
  • 1,253
  • 1
  • 9
  • 17
  • how to get the Page Public Content Access ?? – Valek May 23 '18 at 11:12
  • Submit your app to the Facebook Review is the first step. – Norbert May 23 '18 at 11:14
  • @Valek of course they did, https://developers.facebook.com/docs/graph-api/changelog/breaking-changes - are you people really sleeping through all the news all day …? – CBroe May 23 '18 at 11:40
  • You won’t need PPCA however, if this is your own page you have admin access to - in that case, you can simply use your admin user token or a page token. (Only if you make this request server-side, of course, those kinds of tokens should never be exposed in public client-side code.) – CBroe May 23 '18 at 11:41
  • no its not my page, I'm having headaches to review my app !! it is saying status unapproved. Do I need to fill all the fields for it to get approved? @CBroe – Valek May 23 '18 at 12:08
  • I filled all the fields and yet it is saying unapproved – Valek May 23 '18 at 12:27
  • 1
    Of course this doesn’t change instantly ... what review means, is that someone from Facebook will look at your explanations and your app, that will take several business days. – CBroe May 23 '18 at 12:44