Get order details based on latest updated datetime of the order only

yashrastogi2020
New Member
22 0 0

Hi Team,

Which API can be used to get all order details based on the latest updated datetime of the individual orders? This way, the result set will fetch only unique orders based on the latest updated datetime only, which is our requirement.

 

Regards,

Yash

0 Likes
achieveapplabs
Shopify Partner
472 36 74

Hi Yash,

 

If you're using REST API you can use updated_at_min param with your GET to /orders.json endpoint.

 

updated_at_min

Show orders last updated at or after date (format: 2014-04-25T16:15:47-04:00).

 

https://shopify.dev/docs/admin-api/rest/reference/orders/order?api[version]=2020-07

 

If you're going back 60 days or more you need to request full Orders access through your partner dashboard. 

 

Regards,

Sam Bazargan - Owner

Install Approovly to create and track order approvals | We want to hear from you hello@achieveapplabs.com | Follow us on Twitter @achieveapplabs | Custom Shopify Apps achieveapplabs.com
yashrastogi2020
New Member
22 0 0
Hi Sam,

Lets say, I created an Order on June 20, 2020 at 14:30:00 UTC.

I first updated it on June 25, 2020 at 15:40:00 UTC.

Again I updated this order by creating a fulfillment on June 27, 2020 at
16:00:00 UTC.

Now, when I'll retrieve orders setting updated_at_min = June 15, 2020
00:00:00 UTC, in batches of 5 orders per call, how many times the above
order will appear in my result set?

In my case, I've total 494 orders in my account, first order creation date
being October 07, 2019 12:04:00 UTC.

When I execute the API call (
*/admin/api/2019-10/orders.json?limit=5&updated_at_min=2019-07-19T00:04:46Z&status=any&order=updated_at%20asc*)
inside a for-each loop, I get the total count of orders as 767. How come
this be possible when in total I have only 494 orders only?

Let me know if we can schedule a meeting to check this out together.
0 Likes
yashrastogi2020
New Member
22 0 0

Hi Team,

Can someone respond back on my query asap?

 

Regards,

Yash

0 Likes
achieveapplabs
Shopify Partner
472 36 74

Yash,

 

You can email me directly here: admin@achieveapplabs.com

 

Regards,

Sam

Install Approovly to create and track order approvals | We want to hear from you hello@achieveapplabs.com | Follow us on Twitter @achieveapplabs | Custom Shopify Apps achieveapplabs.com
0 Likes
achieveapplabs
Shopify Partner
472 36 74

Yash,

 

Make sure you're getting the datetime format correct this works for us:

 

const created_at_min = moment(new Date()).format('llll');

 

 

Also you may have archived orders so you should specify the order status in params as well

Filter orders by their status.

(default: open)

  • open: Show only open orders.
  • closed: Show only closed orders.
  • cancelled: Show only canceled orders.
  • any: Show orders of any status, including archived orders.

 

Regards,

Sam 

Install Approovly to create and track order approvals | We want to hear from you hello@achieveapplabs.com | Follow us on Twitter @achieveapplabs | Custom Shopify Apps achieveapplabs.com
0 Likes
achieveapplabs
Shopify Partner
472 36 74

Also these params don't look right:

 

*/admin/api/2019-10/orders.json?limit=5&updated_at_min=2019-07-19T00:04:46Z&status=any&order=updated_at%20asc*)

 

Try this:

 

*/admin/api/2019-10/orders.json?limit=5&updated_at_min=2019-07-19T00:04:46Z&status=open*)

 

Install Approovly to create and track order approvals | We want to hear from you hello@achieveapplabs.com | Follow us on Twitter @achieveapplabs | Custom Shopify Apps achieveapplabs.com
0 Likes
yashrastogi2020
New Member
22 0 0
Hi Sam,

Following call should fetch the outcome on ascending order of
updated_at_min time:

*/admin/api/2019-10/orders.json?limit=5&updated_at_min=
2019-07-19T00:04:46Z&status=any&order=updated_at%20asc*)

What is wrong here?
0 Likes
yashrastogi2020
New Member
22 0 0
Hi Sam,

Date format is correct that we used, and we'd like to retrieve all orders
irrespective of the status of the order.
0 Likes
achieveapplabs
Shopify Partner
472 36 74

At the very end the last Params doesn’t look correct try removing it.

Install Approovly to create and track order approvals | We want to hear from you hello@achieveapplabs.com | Follow us on Twitter @achieveapplabs | Custom Shopify Apps achieveapplabs.com
0 Likes