Dacobah
Dacobah

Reputation: 789

Multiple orders are missing while calling ListOrders on Amazon MWS

I use a cron job to return orders from an Amazon account and it was working fine since 2~3 weeks. Indeed, there are more orders than usual (due to the pre-Christmas period) and it looks like the cron task can't get all orders.

So I decided to schedule it differently to stop missing some of the orders. Now the cron job runs every hour (instead every two hours) and I applied new DateTime('-5 hours', new DateTimeZone('UTC')); to the CreatedAfter requested parameter (before, it was specified as -10 hours).

I had to manually run the cron job to return missing orders which are visible on the amazon interface as "unshipped" and client informations are fully completed.

$start_date = new DateTime('2012-04-12 10:30:00', new DateTimeZone('UTC'));
$request->setCreatedAfter($start_date);

$end_date = new DateTime('2012-04-12 11:30:00', new DateTimeZone('UTC'));
$request->setCreatedBefore($end_date);

Can you tell me why it is still missing some of the orders? Please ask if you more information or code.

Upvotes: 3

Views: 1368

Answers (1)

Josh Brown
Josh Brown

Reputation: 4096

A couple of thoughts:

  1. By default, ListOrders returns a maximum of 100 orders. If there are more than 100 orders, you can retrieve another group of orders using ListOrdersByNextToken. Are you calling ListOrdersByNextToken when it's necessary to do so?
  2. The API documentation says that "For bulk order data reporting, you should create order reports with the Reports API section." http://docs.developer.amazonservices.com/en_US/orders/index.html Have you considered scheduling order reports (using the Reports API) instead of polling ListOrders? You can then send back an order acknowledgement feed to confirm receipt of the orders you got.

Upvotes: 5

Related Questions