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 ?

asked Jun 20, 2019 at 16:47

2 Answers 2

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

answered Jun 20, 2019 at 19:30
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.

answered Jun 21, 2019 at 8:49

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.