0

I am working on Facebook ads API, but I cannot figure out the parameter and breakdown compatibility. Is there a tool that can help me with this or some documentation?

What I found till now: I found this table on the same page as breakdown https://developers.facebook.com/docs/marketing-api/insights/breakdowns/#combiningbreakdowns that says breakdowns we can combine but when I use any of the given permutations that contains action_* I get an error

breakdowns[0] must be one of the following values: ad_format_asset, age, app_id, body_asset, call_to_action_asset, country, description_asset, gender, image_asset, impression_device, link_url_asset, product_id, region, skan_conversion_id, title_asset, video_asset, dma, frequency_value, hourly_stats_aggregated_by_advertiser_time_zone, hourly_stats_aggregated_by_audience_time_zone, place_page_id, publisher_platform, platform_position, device_platform

Then when I try to use the breakdowns given in the error message I get an error that says fields are not compatible. And I am stuck in an infinite loop.

The API call I am currently making is

act_2****28**94****/insights?fields= impression&breakdowns=action_type

using graph API explorer.

So Question1: Is there a tool or documentation that can help me with combinations of parameters and breakdowns?

Question2: Or is there a set of API calls that can help me pull the maximum amount of data in some kind of similar structure?

lovekesh
  • 35
  • 4

1 Answers1

0

Question 1: You can read the documentation here on what combinations are allowed between the action_breakdown and breakdown parameters https://developers.facebook.com/docs/marketing-api/insights/breakdowns/

Question 2: There's not one endpoint to get all the information. You can see the parameters for the v15 endpoint here https://developers.facebook.com/docs/marketing-api/insights/parameters/v15.0 and you can pull the data that you need. If you're trying to pull a lot of data, such as all the data for the account, it's suggested that you split it into multiple API calls pulling in the lower levels. https://developers.facebook.com/docs/marketing-api/insights/best-practices

Here's an example call that I tested with an ad_set id in the graph API explorer

{edge}/insights?fields=date_start,date_stop,campaign_id,campaign_name,spend,account_id,account_name,impressions,reach,frequency,actions&time_increment=1&date_preset=last_90d&action_breakdowns=action_type&breakdowns=country