Have your say in Community Polls: What was/is your greatest motivation to start your own business?
Our Partner & Developer boards on the community are moving to a brand new home: the .dev community forums! While you can still access past discussions here, for all your future app and storefront building questions, head over to the new forums.

Re: I can't get all orders by API, only 189/6508 [with debug log]

Solved

I can't get all orders by API, only 189/6508 [with debug log]

zengxianchao
Tourist
5 2 0

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

zengxianchao_0-1667724812336.png

 

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

zengxianchao_1-1667725013673.png

 

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?

Accepted Solutions (2)

zengxianchao
Tourist
5 2 0

This is an accepted solution.

I noticed that someone had met such problem, I tried all the solution but in vain..

View solution in original post

zengxianchao
Tourist
5 2 0

This is an accepted solution.

now I know what happends, the public app set the default-order-fetch-time is 60days. 

View solution in original post

Replies 3 (3)

zengxianchao
Tourist
5 2 0

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.

zengxianchao
Tourist
5 2 0

This is an accepted solution.

I noticed that someone had met such problem, I tried all the solution but in vain..

zengxianchao
Tourist
5 2 0

This is an accepted solution.

now I know what happends, the public app set the default-order-fetch-time is 60days.