public void getTotalLeads(Campaign campaignFB) throws APIException {
APINodeList<Ad> ads = campaignFB.getAds().execute();
for (Ad ad : ads) {
Ad adFb = new Ad(ad.getId(), context);
APINodeList<Lead> listLeads = adFb.getLeads().execute();
System.out.println("SIZE: " + listLeads.size());
System.out.println("LIST: " + listLeads);
}
}
私の場合に広告がフォームタイプのものであった:
try {
final AdAccount account = new AdAccount(ACCOUNT_ID, context);
final APINodeList<LeadgenForm> forms = account.getLeadGenForms().execute();
for (final LeadgenForm leadgenForm : forms) {
System.out.println(leadgenForm.getId());
final APINodeList<Lead> leads = leadgenForm.getLeads().execute();
for (final Lead lead : leads) {
System.out.println(lead.getFieldFieldData());
}
}
}
catch (final APIException e) {
e.printStackTrace();
}