Join us for an upcoming Shopify Partner webinar on February 27, 2024. Discover the latest Checkout Extensibility features, and deep dive on improvements to Shopify Functions and Web Pixels. Register now for either the 10am EST or 2pm EST sessions.
Solved

How to get fulfilled old orders

JohannDtec
New Member
4 0 0

GET orders url does not include closed orders.

Even by adding ?id=1234567890123 I receive all not fulfilled orders.

...myshopify.com/admin/api/2022-xx/orders/?id=5172240154869

 

I would like to get closed orders from one month ago.

Is there a http what can return me old orders?

Thanks

 

 

Accepted Solutions (2)

ShopifyDevSup
Shopify Staff
1246 201 441

This is an accepted solution.

Hey @JohannDtec

The REST Orders APIs default to returning orders with status=open as indicated in the documentation (despite the fulfillment_status default of any).



When querying the order endpoint for all orders within the last 60 days (see here), I would suggest following the example request provided in the docs to start from, and build filtering from there: 

GET /admin/api/{version}/orders.json?status=any

If the intent of a request is to query instead by a specific order.id, this id value should be included in the URL path and not specifically as a filter - see example here. This endpoint doesn't default to order status values the same way as the endpoint above.

GET /admin/api/{version}/orders/{order_id}.json?{filter_params}


Cheers! 

 

Developer Support @ Shopify
- Was this reply helpful? Click Like to let us know!
- Was your question answered? Mark it as an Accepted Solution
- To learn more visit Shopify.dev or the Shopify Web Design and Development Blog

View solution in original post

ShopifyDevSup
Shopify Staff
1246 201 441

This is an accepted solution.

@JohannDtec, glad it helped! 

In my testing with status=any passed, all archived orders from the last 60 days were returned. When aiming to return orders that are older than 60 day window (available to apps with read_order), instead additional scope access to  read_all_orders will need to be requested , and then updated for the app - more info here. 

In my testing, everything is working as expected - across several apps and stores. However, if you are ever concerned about potentially unexpected behaviors or errors involving our APIs, please don't hesitate to connect with support directly sharing example requests details; endpoint used, request and response body if applicable, any error, and most importantly timeframe and  x-request-id response header value. 

Cheer! 

 

Developer Support @ Shopify
- Was this reply helpful? Click Like to let us know!
- Was your question answered? Mark it as an Accepted Solution
- To learn more visit Shopify.dev or the Shopify Web Design and Development Blog

View solution in original post

Replies 5 (5)

ShopifyDevSup
Shopify Staff
1246 201 441

This is an accepted solution.

Hey @JohannDtec

The REST Orders APIs default to returning orders with status=open as indicated in the documentation (despite the fulfillment_status default of any).



When querying the order endpoint for all orders within the last 60 days (see here), I would suggest following the example request provided in the docs to start from, and build filtering from there: 

GET /admin/api/{version}/orders.json?status=any

If the intent of a request is to query instead by a specific order.id, this id value should be included in the URL path and not specifically as a filter - see example here. This endpoint doesn't default to order status values the same way as the endpoint above.

GET /admin/api/{version}/orders/{order_id}.json?{filter_params}


Cheers! 

 

Developer Support @ Shopify
- Was this reply helpful? Click Like to let us know!
- Was your question answered? Mark it as an Accepted Solution
- To learn more visit Shopify.dev or the Shopify Web Design and Development Blog

JohannDtec
New Member
4 0 0

Thank you for the quick answer on this.

I was able to see some of the closed orders, but looks like if the order is archived it will not be in the returning json file any more. Correct?

 

JohannDtec
New Member
4 0 0

Thank you for the additional information.

It helps lot to know this.

 

ShopifyDevSup
Shopify Staff
1246 201 441

This is an accepted solution.

@JohannDtec, glad it helped! 

In my testing with status=any passed, all archived orders from the last 60 days were returned. When aiming to return orders that are older than 60 day window (available to apps with read_order), instead additional scope access to  read_all_orders will need to be requested , and then updated for the app - more info here. 

In my testing, everything is working as expected - across several apps and stores. However, if you are ever concerned about potentially unexpected behaviors or errors involving our APIs, please don't hesitate to connect with support directly sharing example requests details; endpoint used, request and response body if applicable, any error, and most importantly timeframe and  x-request-id response header value. 

Cheer! 

 

Developer Support @ Shopify
- Was this reply helpful? Click Like to let us know!
- Was your question answered? Mark it as an Accepted Solution
- To learn more visit Shopify.dev or the Shopify Web Design and Development Blog

JohannDtec
New Member
4 0 0

Thank you!