Question

I have an application which I developed about a year ago and I'm fetching facebook accounts like this:

facebookClient = new DefaultFacebookClient(access_token);
Connection<CategorizedFacebookType> con = facebookClient.fetchConnection("me/accounts", CategorizedFacebookType.class);
fbAccounts = con.getData();

It worked fine until about a month ago, but now it returns the fbAccounts list empty. Why is that?

I was hoping moving from restfb-1.6.2.jar to restfb-1.6.9.jar would help but no luck, it comes up empty on both.

What am I missing?

EDIT, to provide the code for another error I have with this API. The following code used to work:

String id = page.getFbPageID(); // (a valid facebook page id)
FBInsightsDaily daily = new FBInsightsDaily(); // an object holding some insights values

try {
    Parameter param = Parameter.with("asdf", "asdf"); // seems like the param is required
    JsonObject allValues = facebookClient.executeMultiquery(createQueries(date, id), JsonObject.class, param);
    daily.setPageActiveUsersDaily((Integer)(((JsonArray)allValues.opt("page_active_users_daily")).getJsonObject(0)).opt("value"));
    ...

This throws the following exception:

com.restfb.json.JsonException: JsonArray[0] not found.
at com.restfb.json.JsonArray.get(JsonArray.java:252)
at com.restfb.json.JsonArray.getJsonObject(JsonArray.java:341)

Again, this used to work fine but now throws this.

Was it helpful?

Solution

You need the manage_pages permission from the user to access their list of adminned pages - a year ago I'm not sure you did - check that you're obtaining that permission from your users

{edit} Some of the insights metrics were also deprecated, the specific values you're checking may no longer exist - https://developers.facebook.com/docs/reference/fql/insights/ should have the details of what is available now

Try to check your queries manually in the Graph API Explorer to eliminate any issues in your code and hopefully get more detailed error messages that your SDK may be swallowing

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top