facebook / facebook-java-business-sdk

Java SDK for Meta Marketing APIs
https://developers.facebook.com/docs/business-sdk
Other
393 stars 324 forks source link

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

Closed yc-gjb closed 1 year ago

yc-gjb commented 1 year ago

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;

yc-gjb commented 1 year ago

insights.setLevel(AdsInsights.EnumLevel.VALUE_AD);