我正在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。我的帐户是企业帐户。此外,广告帐户与该帐户相关联。我怎样才能使这项工作?