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

Async Insights - Exception while parsing image_asset field #449

Closed dellax closed 5 months ago

dellax commented 7 months ago

Which SDK version are you using?

18.0.4

What's the issue?

Exception while parsing image_asset field. Graph api returns object {hash: "", url: "", name: "", id: ""} instead of string (sdk)

https://github.com/facebook/facebook-java-business-sdk/blob/87c547911dc2d68334022c23235f30f1482b0631/src/main/java/com/facebook/ads/sdk/AdsInsights.java#L344

Steps/Sample code to reproduce the issue

========Start of API Call========
Post: https://graph.facebook.com/v18.0/act_xxxxxxxxxxxx/insights
Content-Disposition: form-data; name="access_token"

omitted

Content-Disposition: form-data; name="time_range"

{"since":"2024-01-10","until":"2024-01-10"}

Content-Disposition: form-data; name="level"

ad

Content-Disposition: form-data; name="breakdowns"

image_asset

Content-Disposition: form-data; name="limit"

25

Content-Disposition: form-data; name="appsecret_proof"

omitted

Content-Disposition: form-data; name="fields"

account_id,actions,ad_id,ad_name,adset_id,adset_name,campaign_id,campaign_name,spend,unique_actions,account_name,impressions,reach,clicks,unique_clicks

Content-Disposition: form-data; name="filtering"

[{field: 'action_type',operator:'IN', value: ['app_install', 'mobile_app_install', 'omni_tutorial_completion', 'omni_level_achieved', 'omni_spend_credits', 'omni_purchase', 'omni_achievement_unlocked']}]

----------------------------689313569058869891--

Observed Results:

stcheng commented 7 months ago

thanks for reporting this issue. image_asset is a breakdown and we will need to find a way to figure out how to assign the return type for the breakdowns.

adithya-1 commented 6 months ago

@stcheng Can you please let us know any possible ETA around the fix? Noticed not only image_asset but even body_asset also comes as json, however breakdowns like age come as string. Is there any way we can figure out which breakdowns are string and which are json? Currently checking with hitting the API manually, would like to verify the same with some documentation and https://developers.facebook.com/docs/marketing-api/insights/breakdowns does not have sample responses for all types of breakdowns.

stcheng commented 5 months ago

this has been addressed in our latest release v19.0.1 with the introduction of multiple AdAsset* types support in Java.