我正在使用Facebook API v4获取潜在客户列表(使用PHP和库中内置的get方法.我想知道如何将日期范围传递到请求中,以便仅获取2个日期之间的潜在客户
I'm using the Facebook API v4 to get a list of the leads(using PHP and the get method built into the library. I want to know how to pass a date range into the request to only get leads between 2 dates.
我首先使用以下方法获取广告列表:
I'm first getting a list of adets using the following:
$request = $fb->get( $account_id . '/ads?fields=name&limit=100&transport=cors', $access_token );然后,我遍历这些广告ID以获得一系列潜在客户:
Then I'm looping over those ads id's to get an array of leads:
foreach ($adSets as $ad){ $request = $fb->get( $ad['id'] . '/leads?fields=ad_name,adset_name,campaign_name,created_time,field_data&limit=100', $access_token ); $request->getGraphEdge()->asArray(); }这一切都很好,但是我想获得2个日期之间的潜在客户列表.过滤部分 developers下的文档. facebook/docs/marketing-api/guides/lead-ads/retrieving/提示我可以通过以及from_date和to_date,但我似乎无法满足上述要求.
This all works perfectly fine but I want to get a list of leads between 2 dates. The documentation here under the filtering section developers.facebook/docs/marketing-api/guides/lead-ads/retrieving/ hints I can pass and from_date and to_date but I can't seem to get that working with my above request.
关于如何传递日期范围的任何想法?
Any ideas on how I can pass a date range?
推荐答案您应过滤字段time_created
从在此处提交文档:
此示例根据时间戳过滤销售线索.时间戳记应为 Unix时间戳.
This example filters leads based on timestamps. Timestamps should be Unix timestamp. curl -G \ --data-urlencode 'filtering=[ { "field": "time_created", "operator": "GREATER_THAN", "value": 1516682744 } ]' \ -d 'access_token=<ACCESS_TOKEN>' \ graph.facebook/v4.0/<AD_ID>/leads
请记住:
自Unix纪元以来的秒数
number of seconds since the Unix Epoch
希望获得帮助
更多推荐
如何在设定的时间段内过滤Facebook线索
发布评论