Solved

created_at_min and created_at_max parameters of orders API no longer work properly

ShikhaSharma
Shopify Partner
26 2 2

Getting issue with date and time of the order webhook not getting midnight order and getting that orders in previous date

for example if I use "/admin/api/2020-10/orders.json?status=any&created_at_min=2021-07-28T00:01:00+05:30&created_at_max=2021-07-29T00:01:00+05:30&fields=name,created_at"

this returns me the order of 28 plus orders of midnight 29

and when I add filter of 29 and 30 date I do not get the midnight orders of 29

Accepted Solution (1)
ShikhaSharma
Shopify Partner
26 2 2

This is an accepted solution.

With the issue of orders not being filtered properly, this has to do with the way the + is decoded when it get's to our servers. When a request with the following 2021-07-28T00:01:00+05:30 is sent, the + is decoded as a space and hence the request becomes 2021-07-28T00:01:00 05:30. With this, the timezone portion is ignored and the UTC timezone is used.

To get the appropriate results, you would have to encode the + operator, and this becomes %2B. Thus, the filtered date and timestamp should be 2021-07-28T00:01:00%2B05:30. Doing this, would ensure your results are filtered properly.

Also, I'd like to point out that the recommended way when filtering by dates is always to use the date and timestamp, and not the date only as that leads to UTC time and not the shop's time being used.

View solution in original post

Replies 4 (4)

Ahad007
Visitor
3 0 0

Hello @ShikhaSharma  did you find the solution? we're facing same issue?

ShikhaSharma
Shopify Partner
26 2 2

This is an accepted solution.

With the issue of orders not being filtered properly, this has to do with the way the + is decoded when it get's to our servers. When a request with the following 2021-07-28T00:01:00+05:30 is sent, the + is decoded as a space and hence the request becomes 2021-07-28T00:01:00 05:30. With this, the timezone portion is ignored and the UTC timezone is used.

To get the appropriate results, you would have to encode the + operator, and this becomes %2B. Thus, the filtered date and timestamp should be 2021-07-28T00:01:00%2B05:30. Doing this, would ensure your results are filtered properly.

Also, I'd like to point out that the recommended way when filtering by dates is always to use the date and timestamp, and not the date only as that leads to UTC time and not the shop's time being used.

ShikhaSharma
Shopify Partner
26 2 2

Also if this doesn't save your problem , than if you want to fetch the date from 12 april to 15 april just fetch use date filter as 12 april to 16 april , hope this works as this works for me 

alammediacarry
Shopify Partner
5 0 0

Hi @ShikhaSharma could you please share this query, and if it is possible to fetch data like from last Monday to Sunday. Because i have seen that we can get only max 250 records. But for my project POV, i need to get last 7 days orders and then need to compare them with my database orders and if there is missing some then need to add them pragmatically.