Discussing APIs and development related to customers, discounts, and order management.
Hi,
I meet some problems on "get all orders from the shopify store" by API, the "rel=next" in response.header disappear after several API call. The details is stated as follows:
step1, get the total orders count:
input:https://mystoreaddress.myshopify.com/admin/api/2022-07/orders/count.json?status=any
output:6508
step2, get the orders by page_info:
input:https://mystoreaddress.myshopify.com/admin/api/2022-07/orders.json?status=any&limit=50
output:3 * 50 + 39 = 189 orders
P.S. "len of page_info" is the length of split(response.header['Link'].split(', ')), if the len is 1, only one url in response.header, next or previous; if the len is 2, both previous and next in response.header
len of page_info: 1 next_link https://mystoreaddress.myshopify.com/admin/api/2022-07/orders.json?page_info=eyJzdGF0dXMiOiJhbnlsaW1pdD01MCIsImxhc3RfaWQiOjQ5NTg0NTI3MTE2NzksImxhc3RfdmFsdWUiOiIyMDIyLTEwLTI2IDE4OjI5OjA5LjEzMDQxOCIsImRpcmVjdGlvbiI6Im5leHQifQ continue fetch, fetch_count:%s, size:%s 50 50 len of page_info: 2 next_link https://mystoreaddress.myshopify.com/admin/api/2022-07/orders.json?page_info=eyJkaXJlY3Rpb24iOiJuZXh0Iiwic3RhdHVzIjoiYW55bGltaXQ9NTAiLCJsYXN0X2lkIjo0OTQ3NzUwMTU4NTkxLCJsYXN0X3ZhbHVlIjoiMjAyMi0xMC0xNiAyMToyMToyNS45MTk2MzUifQ continue fetch, fetch_count:%s, size:%s 100 50 len of page_info: 2 next_link https://mystoreaddress.myshopify.com/admin/api/2022-07/orders.json?page_info=eyJkaXJlY3Rpb24iOiJuZXh0Iiwic3RhdHVzIjoiYW55bGltaXQ9NTAiLCJsYXN0X2lkIjo0OTE0MDYzMTgwMDMxLCJsYXN0X3ZhbHVlIjoiMjAyMi0wOS0yMSAxMzo1ODo0Ny41MjgxODIifQ continue fetch, fetch_count:%s, size:%s 150 50 len of page_info: 1 next_link https://mystoreaddress.myshopify.com/admin/api/2022-07/orders.json?page_info=eyJkaXJlY3Rpb24iOiJwcmV2Iiwic3RhdHVzIjoiYW55bGltaXQ9NTAiLCJsYXN0X2lkIjo0OTEzOTgwODAxMjc5LCJsYXN0X3ZhbHVlIjoiMjAyMi0wOS0yMSAxMjowODowOC40MTc5MzkifQ last fetch, fetch_count:%s, size:%s 189 39 done
Question:
1.Why the "rel=next" disappear from response.header after 3 times api call?
2.How can I get all the orders with the status=any?
Solved! Go to the solution
This is an accepted solution.
I noticed that someone had met such problem, I tried all the solution but in vain..
This is an accepted solution.
now I know what happends, the public app set the default-order-fetch-time is 60days.
What's more, my app have the "read all orders" right, so the default 60-days orders is not the reason that cause the problem.
And, I add the status=any
I really don't know how to figure this problem.
This is an accepted solution.
I noticed that someone had met such problem, I tried all the solution but in vain..
This is an accepted solution.
now I know what happends, the public app set the default-order-fetch-time is 60days.