In my android app I am using woocommerce rest api to fetch products from my inventory. As per the documentation "Requests that return multiple items will be paginated to 10 items by default." I need to fetch 25 items per request. As per the documentation I have tried many things but unfortunately I didn't get any success.
For pagination I tried
"mysite/wc-api/v3/products/"+"?page="+pageNum;
Using this I get first 10 products for pageNum = 1, 11-20 i.e next set of 10 items using pageNum = 2 and so on. I need to get 25 items per page.
I tried using
"mysite/wc-api/v3/products?filter[limit]="+25;
but this returns me the first 25 items. Now, how do I get the next set of 25 items i.e. 26 to 50 items.
I can't use
"mysite/wc-api/v3/products?filter[limit]="+50;
as it would give me the first 50 items.
I am referring https://woocommerce.github.io/woocommerce-rest-api-docs/
I just need the endpoints.
Finally I figured out the solution myself:
This is if we need to get 25 items for each request.
The endpoint would be like :
"mysite/wc-api/v3/products?filter[limit]=25&filter[offset]="+offset;
This will give 25 items in one go and in each request I need to send the offset i.e. that will be 0,25,50,75..... at each subsequent request.