【问题标题】:How to get Orders with some criteria via PHP CURL如何通过 PHP CURL 获取具有某些条件的订单
【发布时间】:2015-09-01 12:18:44
【问题描述】:

我想使用具有以下条件的 Bigcommerce PHP 库获取所有订单。

- 订单状态 = 2(已发货)

- 2 天前创建的订单

我正在尝试使用 PHP 中的 CURL 调用来获取订单

当我路过的时候

$api_url = 'https://www.myapiurl.com/api/v2/orders.json?status_id=2';

它返回所有已发货的订单,但是当我尝试通过日期过滤器时,它没有得到想要的结果

$api_url = 'https://www.myapiurl.com/api/v2/orders.json?status_id=2&min_date_created=2015-08-30';

$api_url = 'https://www.myapiurl.com/api/v2/orders.json?status_id=2&min_date_created=2015-08-30';

我该怎么做?

【问题讨论】:

  • min_date_created 可能不是正确的参数。您是否查看过orders 资源上的文档?
  • 看起来日期应该是这种格式:Thu, 15 Nov 2012 21:43:32 +0000
  • 尝试使用这种格式 ** 2012 年 11 月 14 日星期三 19:26:23 +0000 **
  • 它给出以下响应:Array ( [0] => Array ( [status] => 400 [message] => The field 'min_date_created' is invalid. [details] => Array ( [invalid_reason) ] => 提供的值 '"Thu, 15 Nov 2012 21:43:32 0000"' 不是有效的 RFC-2822 或 ISO-8601 日期。)))

标签: php curl bigcommerce


【解决方案1】:

我在商店测试过这种格式并为我工作(我使用的是 bigommerce 的 php api 版本 3)。

https://store-xxxxxxx.mybigcommerce.com/api/v2/orders?status_id=1&min_date_created=2015-03-04

回复:

Array
(
    [0] => stdClass Object
        (
            [id] => 25
            [customer_id] => 0
            [date_created] => Wed, 04 Mar 2015 17:36:34 +0000
            [date_modified] => Wed, 04 Mar 2015 17:36:34 +0000
            [date_shipped] => 
            [status_id] => 1
            [status] => Pending
            [subtotal_ex_tax] => 90.0000
            [subtotal_inc_tax] => 90.0000
            [subtotal_tax] => 0.0000
            [base_shipping_cost] => 0.0000
            [shipping_cost_ex_tax] => 0.0000
            [shipping_cost_inc_tax] => 0.0000
            [shipping_cost_tax] => 0.0000
            [shipping_cost_tax_class_id] => 0
            [base_handling_cost] => 0.0000
            [handling_cost_ex_tax] => 0.0000
            [handling_cost_inc_tax] => 0.0000
            [handling_cost_tax] => 0.0000
            [handling_cost_tax_class_id] => 0
            [base_wrapping_cost] => 0.0000
            [wrapping_cost_ex_tax] => 0.0000
            [wrapping_cost_inc_tax] => 0.0000
            [wrapping_cost_tax] => 0.0000
            [wrapping_cost_tax_class_id] => 0
            [total_ex_tax] => 80.0000
            [total_inc_tax] => 80.0000
            [total_tax] => 0.0000
            [items_total] => 1
            [items_shipped] => 0
            [payment_method] => Manual
            [payment_provider_id] => 
            [payment_status] => 
            [refunded_amount] => 0.0000
            [order_is_digital] => 
            [store_credit_amount] => 0.0000
            [gift_certificate_amount] => 0.0000
            [ip_address] => 
            [geoip_country] => 
            [geoip_country_iso2] => 
            [currency_id] => 1
            [currency_code] => USD
            [currency_exchange_rate] => 1.0000000000
            [default_currency_id] => 1
            [default_currency_code] => USD
            ......
            ....
            ..
            .

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2014-02-16
    • 2015-10-16
    • 2014-01-16
    • 2016-11-12
    • 2017-11-10
    • 2012-07-08
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多