4

I use following API:

  https://github.com/facebook/facebook-python-business-sdk

Where i need to specify limit fields to return more result from facebook.

My code:

fields = [
    AdsInsights.Field.campaign_id,
    AdsInsights.Field.campaign_name,

    AdsInsights.Field.adset_id,
    AdsInsights.Field.adset_name,
    AdsInsights.Field.ad_name,

    AdsInsights.Field.spend,
    AdsInsights.Field.impressions,
    AdsInsights.Field.clicks,
    AdsInsights.Field.account_currency,
]
params = {
    'time_range': {
        'since': for_day,
        'until': for_day
    },
    'fields': fields,
    'breakdowns': ['country'],
    'action_report_time': AdsInsights.ActionReportTime.impression,
    'level': AdsInsights.Level.ad
    # todo: need to find way to query for 500 records
}

async_job = account.get_insights_async(fields=params.get('fields'), params=params)

Later when i watch the result object i see the following:

https://graph.facebook.com/v4.0/yyy/insights?access_token=xxx&limit=25&after=zzz

Matteo
  • 37,680
  • 11
  • 100
  • 115
Alexey Alexeenka
  • 891
  • 12
  • 15

1 Answers1

0

Simply add in the params, as example:

params = {
    'limit': '500',
    'time_range': {
        'since': for_day,
        'until': for_day
    },
    'fields': fields,
    'breakdowns': ['country'],
    'action_report_time': AdsInsights.ActionReportTime.impression,
    'level': AdsInsights.Level.ad
}

hope this help

Matteo
  • 37,680
  • 11
  • 100
  • 115