Restriction on number of orders pulled

Hi
When requesting an order list, the response is limited to 100 orders. These orders always seem to have the most recent order in the system first.

So what this means is that if you have more than 100 orders to retrieve then you cannot ask for the oldest 100 then retrieve the remainder on subsequent calls.

Is there a way to either get all orders in 1 call or at least get the oldest first so you can loop calls to get all available orders

Any help would be appreciated

Best regards
John

Hey!

You’re not able to change the order the orders return in, instead the way pulling all orders is generally done is put your fetch in a while loop that has an incremental value. This can be used for the page parameter in your get request. Finally you’ll need an escape from your while block when an error is returned upon requesting a page beyond the number that are available

Hope this makes sense?

Cheers,
Calum

Hi Calum

Thank you for your reply

Using a while loop to achieve getting all orders was my first thought, but I see a problem with that.

Forgive me if I am missing something but the parameters are from a created or updated date, or from a given id. With the return of the first iteration returning the most recent orders, it is not clear how to make subsequent iterations go backwards. If the oldest 100 were returned you would simply advance the date/id to the most recent returned, and then go again until you received no more orders.

Trying to do that with the current setup would surely result in the same orders being returned on each iteration. Maybe I am not seeing an offset param in the API call

Best regards
John

Hey John,

If we take a look at the order endpoint documentation here:
https://developer.veeqo.com/docs#/reference/orders/order-collection/list-all-orders

You’ll see there’s a page parameter to step through each set of 100 orders

page Page to show Integer

Cheers,
Calum

Hi Calum

Thank you for that, I had missed the page param in there.

So you just keep calling the endpoint for orders incrementing the value of page, until you get an error?

Would be nice if you could be told the page count or total orders matching criteria, in advance

Best regards
John

| calum
September 4 |

  • | - |

Hey John,

If we take a look at the order endpoint documentation here:
https://developer.veeqo.com/docs#/reference/orders/order-collection/list-all-orders

You’ll see there’s a page parameter to step through each set of 100 orders

page Page to show Integer

Cheers,
Calum

Hey John,

Yeah that’s probably the best approach to take

You can use the response headers to get the number of pages X-Total-Pages-Count but it can be easier to go until you hit an error

Thanks,
Calum