The response if mapped to AdsInsights , hence several fields are removed
{"account_id":"...","account_name":".....,"adset_id":"....","adset_name":"....","campaign_id":"...","campaign_name":"...","cpm":"8...","ctr":"...","date_start":"....date_stop":"....","impressions":"...","inline_link_clicks":"..","inline_post_engagement":"..","objective":"..","spend":".."}
Expected Results:
AdsInsights should have all the fields in the pojo
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:
{"account_id":"...","account_name":".....,"adset_id":"....","adset_name":"....","campaign_id":"...","campaign_name":"...","cpm":"8...","ctr":"...","date_start":"....date_stop":"....","impressions":"...","inline_link_clicks":"..","inline_post_engagement":"..","objective":"..","spend":".."}
Expected Results: