I want to get orders based on date range for example orders of today or yesterday etc. Problem is that I get the count of orders for specified date correctly, but when I hit the api to get all those orders then some of them are missing in response. Here are api endpoints that I am hitting:
For orders count of today:
https://mystore.myshopify.com/admin/api/2021-10/orders/count.json?created_at_min=2022-01-06T00:00:00%2B05:00&created_at_max=2022-01-06T23:59:59%2B05:00&status=any&limit=250
For fetching orders of today:
https://mystore.myshopify.com/admin/api/2021-10/orders.json?created_at_min=2022-01-06T00:00:00+05:00&created_at_max=2022-01-06T23:59:59+05:00&status=any&limit=250
Any help is appreciated.
Okay so problem was in the format of date which I was providing in /orders.json api. Found this answer from @mayoub helpful: https://community.shopify.com/c/shopify-apis-and-sdks/some-orders-are-missing-shopify-order-api/td-p/998978/highlight/true/page/2.
Just use the ISO format for dates instead of adding timezone offset.
instead of:
2022-01-06T00:00:00+05:00
use this:
2022-01-05T19:00:00.000Z
But yes still do’nt know why /count.json api worked with timezone offset instead of ISO format.