0
votes

I am trying to integrate Magento with our own inventory management. When using the catalogInventoryStockRegistry POST API: http://magento-dev/rest/V1/products/T760/stockItems/2

I got an internal error:

"message":"Class Magento\TargetRule\Model\Catalog\Product\Attribute\Backend\Rule does not exist", "trace":"#0 /var/www/html/magento2/vendor/magento/module-catalog-inventory/Model/StockRegistry.php(194): Magento\CatalogInventory\Model\Stock\StockItemRepository->save(Object(Magento\CatalogInventory\Model\Stock\Item))\n#1 [internal function]: Magento\CatalogInventory\Model\StockRegistry->updateStockItemBySku('T760', Object(Magento\CatalogInventory\Model\Stock\Item))\n#2 /var/www/html/magento2/vendor/magento/module-webapi/Controller/Rest.php(265): call_user_func_array(Array, Array)\n#3 /var/www/html/magento2/vendor/magento/module-webapi/Controller/Rest.php(160): Magento\Webapi\Controller\Rest->processApiRequest()\n#4 /var/www/html/magento2/var/generation/Magento/Webapi/Controller/Rest/Interceptor.php(24): Magento\Webapi\Controller\Rest->dispatch(Object(Magento\Framework\App\Request\Http))\n#5 /var/www/html/magento2/vendor/magento/framework/App/Http.php(115): Magento\Webapi\Controller\Rest\Interceptor->dispatch(Object(Magento\Framework\App\Request\Http))\n#6 /var/www/html/magento2/vendor/magento/framework/App/Bootstrap.php(258): Magento\Framework\App\Http->launch()\n#7 /var/www/html/magento2/pub/index.php(37): Magento\Framework\App\Bootstrap->run(Object(Magento\Framework\App\Http))\n#8 {main}"

All my ids should be valid - I used the output data from GET, just update the qty. Any suggestions on how to find out which rule failed?

2
Please post the code! - Enigmativity

2 Answers

0
votes

Your API likely isn't the problem. My issue, in relation to the error you see, is that the M2 Sample Data adds EAV attributes that reference a 'TargetRule' class, but doesn't include that module.

You can delete those attributes from the database, or simply install a new M2 instance without the sample data.

-1
votes

please post your code here so anyone check code and can give you suggestion that what are you doing wrong.

And if you are using magento rest API then write below code in the starting of file

error_reporting(E_ALL); 

ini_set("display_errors", 1);

require_once '../app/Mage.php'; Mage::app();