How can i define a filter for Facebook Marketing API for the method get_lead_gen_forms? I have tried passing some params, but nothing works.
I need to filter by date because the number of data is exceeding my limit. Here's my code (* the code already works, need help with the filter):
from facebook_business.api import FacebookAdsApi
from facebook_business.adobjects.adaccount import AdAccount
FacebookAdsApi.init(my_app_id, my_app_secret, my_access_token)
account = AdAccount('act_accountid')
leadgenforms = account.get_lead_gen_forms()
And here is the params that i have tried:
# attempt 1
params = {
'time_range': {
'since': date_start,
'until': date_end
}
}
leadgenforms = account.get_lead_gen_forms(params=params)
# attempt 2
params = {
'filtering': [{
'field': 'created_time',
'operator': 'GREATER_THAN',
'value': date_start }]
}
leadgenforms = account.get_lead_gen_forms(params=params)
You should filter for the field
time_created
instead ofcreated_time
.From the section Filtering Leads of the doc here:
So, in the second attempt example:
you should use, ad
date_start
, a date in format of the unix timestamp:Hope this help