TWILIO-API: 列出数据范围内的记录

TWILIO-API: List recording within a data range

Twilio 网站上提供的这个示例不起作用:

$records = $client->recordings->read(0, 10, array(
"datecreatedBefore" => "2016-12-04",
"datecreatedAfter" => "2016-12-01"    
));

它仍然显示超出此范围的录音。知道如何按日期过滤吗?

谢谢!

这里是 Twilio 开发人员布道者。

v4 Twilio PHP library to the v5 library 翻译过来似乎有误。以前,getIterator 方法在其余过滤选项之前采用页面和页面大小参数。

$recordings = $client->account->recordings->getIterator(0, 50, array(
    "DateCreated<" => "2016-10-15",
    "DateCreated>" => "2016-10-12"
))

使用 v5 库,read takes the array of options first, followed by a limit and then page size。因此,要使用限制为 10 的迭代器,您需要这样调用它:

$recordings = $client->recordings->read(array(
    "datecreatedBefore" => "2016-12-04",
    "datecreatedAfter" => "2016-12-01" 
), 10, 10);

如果这有帮助,请告诉我。