cancel
Showing results for 
Search instead for 
Did you mean: 

POST REST API Magento 2

POST REST API Magento 2

Hi all, I used the service REST API to insert products, but it happens to me a strange thing, when I insert in the title the word "HP 250 G4" I get this error

 

"object (stdClass) # 289 (1) {[" message "] = > string (22) "Unable to save product"} "

 

Here's an example of my call to the bees:

 

 

$data = array(
                    "product" => array(
                    "sku" => $prod->sku,
                    "name" => 'HP 250 G4',
                    "attributeSetId" => 91,
                    "price" => $prod->price,
                    "status" => 1,
                    "extensionAttributes" => array(
                        "stockItem" => array(
                            "qty" => $prod->qty,
                            "is_in_stock" => true,
                        ),
                    ),
                    "customAttributes" => array(
        array(
            "attributeCode" => "snumero_di_threads_del_process",
            "value" => "valoreTest"
            ),
        array(
            "attributeCode" => "activity",
            "value" => 0
            ),
        array(
            "attributeCode" => "color",
            "value" => 0
            ),
        array(
            "attributeCode" => "category_ids",
            "value" => 241
            ),
        array(
            "attributeCode" => "description",
            "value" => "<p>Test descrizione</p>"
            ),
        array(
            "attributeCode" => "tax_class_id",
            "value" => "2",
            ),
        array(
            "attributeCode" => "short_description",
            "value" => "Descrizione corta",
            ),
        array(
            "attributeCode" => "manufacturer",
            "value" => "Enzo",
            ),
    ),
));  

 

The strange thing is that if I put in the title of this "HP250 G4" text works. Apparently, it seems that annoys the number separated from other words in the title.

 

What could be your problem?

Thanks

Tags (2)
1 REPLY

Re: POST REST API Magento 2

I found the problem, undergoing various tests, he had created the link rewrite db, and so it was in conflict. The worst thing is that thus special magento I did not specify where the error had occurred.