0

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 ?

0

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

0

The problem was better described here:

Product rest api is not returning results in magento 2.2.5

It seems to be a bug with magento or maybe it has nothing to do with my problem.

BUT

If someone has a similar problem for me the problem was the json_encode. vendor/magento/zendframework1/library/Zend/Json.php

function encode line 154: $encodedResult = json_encode($valueToEncode); I added the json_last_error and I saw that it was giving me an error with utf-8 encoding. That error wasn't showing anywhere until I managed to debug the REST API session.

I hope it will help someone.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.