Dealing with Complex Schema API
I want to create a complex schema for ProductVariant entity. I follow the implementation of Tony-Restapicomplex module but i got an exception such as :
There is no model schema for that class. This is my schema : PHP Code:
And this is the Complex.php file that decorate \XLite\Module\XC\RESTAPI\Core\Schema\Complex : PHP Code:
What is wrong ?! The demo-entity works very well. But ProductVariant not. |
Re: Dealing with Complex Schema API
@Alex,
You should try to implement getAllowedEntityClasses() method as follows: Code:
protected function getAllowedEntityClasses() In other words, the key of return array must be name of model class and the value must be name of the class that implements the complex schema. Please, let me know if it helps. Quote:
|
Re: Dealing with Complex Schema API
Quote:
I tested and it works very well. Now I have another issue. Because I have very much products and productvariants, sometimes I get an 500 error because the server takes much time to respond. I want to create a tool that pull products from API in batches but for that I need instead reciving all products, get only number of rows. Is there a posibility to do that ? By default convertModel() function fetching result for each rows of entity. |
Re: Dealing with Complex Schema API
Quote:
Did you try using _cnd[limit] in your request as explained here: https://devs.x-cart.com/rest-api/#limiting-the-output-pagination Just add something like _cnd[limit][0]=0&_cnd[limit][1]=100 to your request and it will pull batches of entities instead of all. |
Re: Dealing with Complex Schema API
Quote:
|
Re: Dealing with Complex Schema API
Quote:
Knowing total number of rows is not necessary as you should stop sending requests once you receive first empty result. |
All times are GMT -8. The time now is 06:48 PM. |
Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.