我正在使用WooCommerce REST API(http://woocommerce.github.io/woocommerce-rest-api-docs/#introduction),并且能够成功下载客户,订单等。我现在只想下载两个日期之间的订单列表 - 我可以在Orders的文档中看到以下参数:
after string Limit response to resources published after a given ISO8601 compliant date.
before string Limit response to resources published before a given ISO8601 compliant date.
我已将请求的网址修改为:
https://mywebsite.com/wp-json/wc/v1/orders?after=2016-08-05&before=2016-08-06&page=1
但是这个回复我得到400错误:
{
"code": "rest_invalid_param",
"data": {
"params": {
"after": "The date you provided is invalid.",
"before": "The date you provided is invalid."
},
"status": 400
},
"message": "Invalid parameter(s): after, before"
}
据我所知,2个日期是符合ISO8601标准的有效日期。无法找到此请求应如何显示的示例,因此不确定从何处开始。
答案 0 :(得分:6)
事实证明你还需要指定时间,例如
after=2016-11-20T13:57:31.2311892-04:00