0

On Saving the products in Magento 2 using REST API it will it will generate the error my payload is:

{
      "product": {
        "sku": "test1",
        "name": "test1",
        "attribute_set_id": 4,
        "price": 25,
        "status": 1,
        "visibility": 4,
        "type_id": "simple",
        "weight": "0.5",
        "extension_attributes": {
            "category_links": [
                {
                    "position": 0,
                    "category_id": "11"
                },
                {
                    "position": 1,
                    "category_id": "12"
                },
                {
                    "position": 2,
                    "category_id": "16"
                }
            ],
            "stock_item": {
                "qty": "10",
                "is_in_stock": true
            }
        },
        "custom_attributes": [
            {
                "attribute_code": "description",
                "value": "The Champ Tee keeps you cool and dry while you do your thing. Let everyone know who you are by adding your name on the back for only $10."
            },
            {
                "attribute_code": "tax_class_id",
                "value": "2"
            },
            {
                "attribute_code": "material",
                "value": "148"
            },
            {
                "attribute_code": "pattern",
                "value": "196"
            },
            {
                "attribute_code": "color",
                "value": "52"
            },
            {
                "attribute_code": "size",
                "value": "168"
            }
        ]
      }
    }

the error is:

        {
        "message": "The product was unable to be saved. Please try again.",
        "trace": "#0 /var/www/html/reg-dealers/vendor/magento/module-catalog/Model/ProductRepository.php(569): Magento\\Catalog\\Model\\ProductRepository->saveProduct(Object(Magento\\Catalog\\Model\\Product\\Interceptor))\n#1 /var/www/html/reg-dealers/vendor/magento/framework/Interception/Interceptor.php(58): Magento\\Catalog\\Model\\ProductRepository->save(Object(Magento\\Catalog\\Model\\Product\\Interceptor))\n#2 /var/www/html/reg-dealers/vendor/magento/framework/Interception/Interceptor.php(138): Magento\\Catalog\\Model\\ProductRepository\\Interceptor->___callParent('save', Array)\n#3 /var/www/html/reg-dealers/vendor/magento/framework/Interception/Interceptor.php(153): Magento\\Catalog\\Model\\ProductRepository\\Interceptor->Magento\\Framework\\Interception\\{closure}(Object(Magento\\Catalog\\Model\\Product\\Interceptor), false)\n#4 /var/www/html/reg-dealers/generated/code/Magento/Catalog/Model/ProductRepository/Interceptor.php(26): Magento\\Catalog\\Model\\ProductRepository\\Interceptor->___callPlugins('save', Array, Array)\n#5 [internal function]: Magento\\Catalog\\Model\\ProductRepository\\Interceptor->save(Object(Magento\\Catalog\\Model\\Product\\Interceptor), false)\n#6 /var/www/html/reg-dealers/vendor/magento/module-webapi/Controller/Rest/SynchronousRequestProcessor.php(95): call_user_func_array(Array, Array)\n#7 /var/www/html/reg-dealers/vendor/magento/module-webapi/Controller/Rest.php(188): Magento\\Webapi\\Controller\\Rest\\SynchronousRequestProcessor->process(Object(Magento\\Framework\\Webapi\\Rest\\Request\\Proxy))\n#8 /var/www/html/reg-dealers/vendor/magento/framework/Interception/Interceptor.php(58): Magento\\Webapi\\Controller\\Rest->dispatch(Object(Magento\\Framework\\App\\Request\\Http))\n#9 /var/www/html/reg-dealers/vendor/magento/framework/Interception/Interceptor.php(138): Magento\\Webapi\\Controller\\Rest\\Interceptor->___callParent('dispatch', Array)\n#10 /var/www/html/reg-dealers/vendor/magento/framework/Interception/Interceptor.php(153): Magento\\Webapi\\Controller\\Rest\\Interceptor->Magento\\Framework\\Interception\\{closure}(Object(Magento\\Framework\\App\\Request\\Http))\n#11 /var/www/html/reg-dealers/generated/code/Magento/Webapi/Controller/Rest/Interceptor.php(26): Magento\\Webapi\\Controller\\Rest\\Interceptor->___callPlugins('dispatch', Array, Array)\n#12 /var/www/html/reg-dealers/vendor/magento/framework/App/Http.php(116): Magento\\Webapi\\Controller\\Rest\\Interceptor->dispatch(Object(Magento\\Framework\\App\\Request\\Http))\n#13 /var/www/html/reg-dealers/vendor/magento/framework/App/Bootstrap.php(263): Magento\\Framework\\App\\Http->launch()\n#14 /var/www/html/reg-dealers/index.php(42): Magento\\Framework\\App\\Bootstrap->run(Object(Magento\\Framework\\App\\Http\\Interceptor))\n#15 {main}"
    }

it will be perfectly running before but now it will give an error and on saving from Magento admin it will give this error.

  SQLSTATE[42S02]: Base table or view not found: 1146 Table 'reopt.scconnector_google_remove_cl' doesn't exist, query was: INSERT INTO `catalog_product_entity` (`entity_id`, `attribute_set_id`, `type_id`, `sku`, `has_options`, `required_options`, `created_at`, `updated_at`) VALUES (?, ?, ?, ?, ?, ?, ?, ?)

Any help is appriciated.

1
  • which magento version are you using?
    – Diana
    Commented Mar 22, 2021 at 9:02

2 Answers 2

1

I don't think this has to do anything with your rest api call. There might be some triggers left from the Magento_GoogleShoppingAds module which now are set to action when you save the product from admin.

The module is now discontinued as of 28.04.2020 when it was removed from all Magento versions (Reference https://docs.magento.com/user-guide/sales-channels/google-eol.html) and I think that you still have some triggers in your database.

There are other threads complaining of similar issues:

Magento 2.3.5 - Large table scconnector_google_feed_cl
Magento 2.3.4 to 2.4 after upgrade product can't save showing error
scconnector_google_feed_cl error after product save (just upgraded to 2.3.5-p2)

So my suggestion is to read those threads, check your db triggers and see if you need to drop those referencing the discontinued module.

1
  • 1
    @thanks it helps
    – Prits
    Commented Mar 22, 2021 at 10:26
0

It will be done by using this link

Magento 2.3.5 - Large table scconnector_google_feed_cl

and also need to disable the module and then run

php bin/magento setup:upgrade and php bin/magento setup:di:compile

commands

then it will solved the issue.

0

Your Answer

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

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