facebook / facebook-java-business-sdk

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

Several fields not available in java object AdsInsights #384

Open garuna-m6 opened 2 years ago

garuna-m6 commented 2 years ago

Which SDK version are you using?

com.facebook.business.sdk:facebook-java-business-sdk:13.0.0

What's the issue?

hourly_stats_aggregated_by_advertiser_time_zone is not a field that can be requested or parsed from response.

Steps/Sample code to reproduce the issue

String[] FIELDS = new String[]{ "account_id" , "account_name" , "campaign_id" , "campaign_name" , "adset_id" , "adset_name" , "date_start" , "date_stop" , "actions" , "canvas_avg_view_percent" , "canvas_avg_view_time" , "cost_per_inline_link_click" , "cost_per_inline_post_engagement" , "cpm" , "cpp" , "ctr" , "estimated_ad_recall_rate" , "estimated_ad_recallers" , "frequency" , "impressions" , "inline_link_clicks" , "inline_post_engagement" , "objective" , "reach" , "spend" , "unique_link_clicks_ctr" , "video_30_sec_watched_actions" , "video_p100_watched_actions" , "video_p25_watched_actions" , "video_p50_watched_actions" , "website_ctr" };

AdReportRun asyncRequest = new AdAccount(accountId, context).getInsightsAsync() .setLevel(AdsInsights.EnumLevel.VALUE_ADSET) .setTimeRange("{'since':'" + date + "','until':'" + date + "'}") .setBreakdowns(Arrays.asList(AdsInsights.EnumBreakdowns.VALUE_HOURLY_STATS_AGGREGATED_BY_ADVERTISER_TIME_ZONE)) .setActionReportTime(AdsInsights.EnumActionReportTime.VALUE_IMPRESSION) .requestFields(Arrays.asList(FIELDS)) .execute();

List<AdsInsights> apiResponse = asyncRequest.fetch().getInsights() .requestFields(Arrays.asList(FIELDS)) .requestField("hourly_stats_aggregated_by_advertiser_time_zone") .execute() .withAutoPaginationIterator(true).stream().collect(Collectors.toList());

Observed Results:

Expected Results: