I am creating an analytics
page for my website. So I need to get data from facebook API. My current code is
public class HelloFacebookAPI {
public static final String ACCESS_TOKEN = [TOKEN];
public static final long ACCOUNT_ID = [ACCOUNT_ID];
public static final String APP_SECRET = [APP_SECRET];
public static final APIContext context = new APIContext(ACCESS_TOKEN, APP_SECRET);
public static void main(String[] args) {
try {
AdAccount account = new AdAccount(ACCOUNT_ID, context);
System.out.println(account.getFieldAmountSpent());
} catch (Exception e) {
e.printStackTrace();
}
}
}
But this keeps returning null. My account is a Business account. Also and Ad account is associated with the account. How can I make this work?