facebook / facebook-java-business-sdk

Java SDK for Meta Marketing APIs

Home Page:https://developers.facebook.com/docs/business-sdk

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

I can't get ad_id,ad_name,adset_id,adset_name's data in AdReportRun.APIRequestGetInsights.

yc-gjb opened this issue · comments

commented

Which SDK version are you using?

    <dependency>
        <groupId>com.facebook.business.sdk</groupId>
        <artifactId>facebook-java-business-sdk</artifactId>
        <version>17.0.0</version>
    </dependency>

What's the issue?

I can't get ad_id,ad_name,adset_id,adset_name's data in report

Steps/Sample code to reproduce the issue

1.createReport
AdAccount account = new AdAccount("${act_id}", context);
AdAccount.APIRequestGetInsightsAsync insights = account.getInsightsAsync();
insights.setFields(Lists.newArrayList("ad_id","ad_name","adset_id","adset_name"));
AdReportRun execute = insights.execute();
2.getReport
AdReportRun adReportRun = new AdReportRun("${report_id}",context);
try {
AdReportRun.APIRequestGetInsights insights = adReportRun.getInsights();
APINodeList execute = insights.execute();
System.out.println(execute );
} catch (APIException e) {
e.printStackTrace();
}

Observed Results:

I want to get ad_id's data,but there is null;

commented

insights.setLevel(AdsInsights.EnumLevel.VALUE_AD);