我正在为我的网站创建一个analytics
页面。所以我需要从facebook API获取数据。我目前的代码是
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();
}
}
}
但这会一直返回null。我的帐户是商家帐户。此外,广告帐户与该帐户相关联。我怎样才能做到这一点?