Magento – Magento 2.3 Custom Rest Api get size limit

apimagento2.3.1rest

I have made custom API which returns the categories with the products in them like this:
array(
key: Category name
values:product1,product2,…productX
(

where product is an array:
array(id,price,name,etc)

This was working ok until there were more categories and products. It can still return some small categories meaning with less products but there is a parent category for example which has 3 children categories with 500 products each.
And my question is: Is there a limit somewhere on magento or on the server on the GET call ?

Best Answer

Are you asking if you can limit collection? If so look into

searchCriteria[currentPage]

And

searchCriteria[pageSize]

As in

/V1/products?searchCriteria[pageSize]=20

Magento2 provides Magento_Swagger module to list, visualise and at the same time test the API resources.

If you have installed Magento2 on your server then you can easily access all the API resources listed on your website by just hitting this URL:

http://www.your_url.com/swagger