Get Shipments for date range?

In Shipments endpoint start/end date seem to apply only to order date. How can I filter on ship_date using range? No documetation on how to use search parameter… Very frustrating lack of documentation and limited examples…

I need to find shipments made from start to end date regardless of order date.


There is no filter available for shipments on ship_date, you can sort by ship_date. The start_date and end_date refer to the date the shipment was created.

Thank you Sophie. Our accounting department requires we use the ship_date as period cut offs, regardless of the date an order (Magento2) was created.

Would it be true that if I used just an end_date parameter of the first day after the ship_date range I want and sort ship_date descending and iterate the results until I reach the begining ship_date of my selection period I would get all shipment made in the accounting period?

How can you specify sort order on the sort parameter?


If you want to sort ship_date descending: sort=-ship_date. - is the distinction here, and without it sort=ship_date will be ascending.

I think you’ll want to filter down to status=shipped shipments, and sort by ship_date.

As for the date you would want to specify for an end_date, that would depend on what time or how soon after an order is placed it is then shipped. You may still need to filter out some orders based on the end day of the ship_date you are looking for.

Hope that helps!

Thanks again Sophie.
Since my query will be run after the end of the shipping period in question and a shipment can’t be made on an order not yet placed I can use end_date of midnight of the last day of the reporting period.

Question - It appears from testing that end_date includes orders place on the end_date. How does end_date get interpreted if it is 2017-12-31 (ie short format)? Is it takenen as 2017-12-31T00:00:00+00:00 or 2017-12-31T23:59:59T00?

Also are all ordror db time staps recorded as GMT (ie +00:00)?

And finaly can you provide a link to good documentation on using apiary? I have found very little usefull information…

The short format will be the beginning of date. 00:00

We factor in timezones, and store in UTC.

I’m not sure of any good docs on using apiary off the top of my head. If you have specific questions on using it, feel free to post another thread, and I would be happy to answer to the best of my ability.

Thanks Sophie.
Regarding using dates and their use in api perameters:
Does the api interpret date time parameters as local (ordoro servers time zone) and then convert to UTC as used in the DB?
Or do I need to send Date times ranges in the actual DB date time values?

If the former does the api adjust for daylight saving time adjustments as part of its conversion to UTC/DB time ?

Thanks again.

You should be able to specify the timezone offset in the datetime string parameter. This should account for DST.

What I need to understand is ultimately what time stamp value should I be targeting with my api perameters. The DB time stamp value or the local time at your server handling the api?

So if I want to get shipments end_date of 1/31/2018 23:59:59 in tz -6 , do I ask for the db end date in this case 02/01/2018 05:59:59 00:00:00 or use 01/31/2018 23:59:59 -06:00:00??



If you are providing a timestamp and offset, you should receive similar results either way. If you are receiving differing results, please let us know.

If you are looking for the timezone -6, then you should either provide the offset in the datetime that is passed into the API, or convert to UTC before making the request. If daylight savings time is in effect and your offset is typically -6, then it becomes -5 during DST. If you are providing an offset with your timestamp you would provide the adjusted offset to account for this.