dongze5043 2017-05-19 16:48
浏览 621

亚马逊MWS / PHP /获得所有订单

i'm trying to get ALL orders from amazon mws. i'm aware that i can only get 100 times at a time and need to use the "nextToken2" for paging through the data. however, what i'm not getting is how to set setCreatedAfter and setCreatedBefore for the request .. i find it very confusing that MWS expects both values to be set.

i found this code snippet:

$t1 = date("c", time()-2*24*60*60);
$t2 = date("c", time()-1*24*60*60);
$request = new MarketplaceWebServiceOrders_Model_ListOrdersRequest();
$request->setSellerId(MERCHANT_ID);
$request->setMarketplaceId(marketplace_id);
$request->setCreatedAfter($t1);
$request->setCreatedBefore($t2);

it will get all orders within the past 30 days. but how can i get ALL orders?

  • 写回答

1条回答 默认 最新

  • dongwu9972 2017-05-19 19:10
    关注

    To get all orders via ListOrders, set your setCreatedAfter date to a date before the earliest order that was ever taken. Set the setCreatedBefore date to the current date/time. This is just simply a range of dates for which you want orders returned. You need to create a range big enough to cover all orders.

    After your first call, check for a NextToken. If it exists, you have more orders, so start a loop until NextToken is empty. Once it's empty, you have all orders.

    Be aware of throttling issues. You may have to slow your operation down.

    Another way is to use the Reports API, which avoids throttling issues, but has extra steps to set up.

    评论

报告相同问题?

悬赏问题

  • ¥15 素材场景中光线烘焙后灯光失效
  • ¥15 请教一下各位,为什么我这个没有实现模拟点击
  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 保护模式-系统加载-段寄存器