Discussing APIs and development related to customers, discounts, and order management.
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
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
Hi Team,
Can someone respond back on my query asap?
Regards,
Yash
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)
Regards,
Sam
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*)
At the very end the last Params doesn’t look correct try removing it.
Hi,
Then what is the way to retrieve the orders in an ascending order of updated_at_min time?
Regards,
Yash
Hi Sam,
Can I get a quick reply on this, as a live customer is facing issues?
Regards,
Yash
Check the suggestion in the following post:
https://community.shopify.com/c/Shopify-APIs-SDKs/Ordering-Results-of-Order-API/td-p/488489
Hey Sam,
Any idea how we can do this through Graph API? I'm really struggling to achieve a similar result using updated_at.
Thanks!
Dan
{
orders (first: 1, query: "updated_at_min='2021-10-21T23:39:20Z'") {
edges {
node {
id
lineItems(first: 1){
edges {
node {
id
name
title
variant {
id
title
}
product {
id
title
}
vendor
sku
Hi @dancooke ,
I haven't used GraphQL so I wouldn't be helpful here.
If you're not getting an error like 400 bad request and just getting an empty result set. Remember that without explicit approval from Shopify you will only be searching through orders that have been placed in the last 60 days.
Hope this helps and see you all in 2022!
Best,
Sam