cancel
Showing results for 
Search instead for 
Did you mean: 

not getting total orders at one time

not getting total orders at one time

Hello everyone,

I want to call the API of getting all orders. But in one call it gives the total of 100 orders in single call. For getting total number of orders weather it is 300, 400, or 500 in single call. Than how to make it possible. through loop and recursion.

Any suggestion is very helpful. 

 

Thank You.

 

 

4 REPLIES 4

Re: not getting total orders at one time

Hi @harshita_chouhan,

 

Maybe you can use the params to set the page size and the current page?

 

/rest/V1/orders?... searchCriteria[currentPage]=1&searchCriteria[pageSize]=100

 

If you maybe you can build your own endpoint to get the total and then use hte result for that?

Re: not getting total orders at one time

Hello @Damian Culotta,

 

Yes, I use [PageSize]=100 but it gives only 100 orders at first time. what to do to get total orders of 400 at one time.

 

Thank you

Re: not getting total orders at one time

Hi @harshita_chouhan,


Did you tried changing [PageSize]=100 to [PageSize]=400? (I didn't checked)

Also, remember that increasing the maximum returned records may have performance implications.

Maybe is a better idea to retrieve large amounts of records using pagination.

For example, first you get records from 1 to 100 in a call, then you get from 101 to 200, then from 201 to 300, etc.

Get smaller sets of records in different calls.

Re: not getting total orders at one time

Hello @Damian Culotta,

 

Is this right to take [PageSize]=400. I mean there is no limitation in orders for getting all orders at one time. May be I thought there would be a limit for getting orders at one time in Magento2 which is 100.

But If, I apply pagination so the problem will be solved by apply logic of recursion.

 

Thank You..