$productData = array(
'sku' => 'MSD',
'name' => 'MSD',
'visibility' => 4, /*'catalog',*/
'type_id' => 'simple',
'price' => 5,
'status' => 1,
'attribute_set_id' => 4,
'weight' => 1,
'custom_attributes' => array(
array( 'attribute_code' => 'category_ids', 'value' => ["3"] ),
array( 'attribute_code' => 'description', 'value' => 'Simple Description' ),
array( 'attribute_code' => 'short_description', 'value' => 'Simple Short Description' ),
),
);
and passing data like below
$result = $soapClient->catalogProductRepositoryV1save(array('product' => $productData));
I got this error
Fatal error: Uncaught SoapFault exception: [env:Sender] Invalid product data: %1 in D:\xampp\htdocs\magento214\vendor\zendframework\zend-soap\src\Client.php:1116 Stack trace: #0 D:\xampp\htdocs\magento214\vendor\zendframework\zend-soap\src\Client.php(1116): SoapClient->__soapCall('catalogProductR...', Array, NULL, NULL, Array) #1 D:\xampp\htdocs\magento214\soap5.php(34): Zend\Soap\Client->__call('catalogProductR...', Array) #2 {main} thrown in D:\xampp\htdocs\magento214\vendor\zendframework\zend-soap\src\Client.php on line 1116
1 Answer 1
Replace attribute_set_id with attributeSetId and type_id with typeId:
$productData = array(
'sku' => 'MSD',
'name' => 'MSD',
'visibility' => 4, /*'catalog',*/
'typeId' => 'simple',
'price' => 5,
'status' => 1,
'attributeSetId' => 4,
...
-
How to send 'qty' => '30.0000' Please?Juliano Vargas– Juliano Vargas2018年02月19日 20:20:47 +00:00Commented Feb 19, 2018 at 20:20
Explore related questions
See similar questions with these tags.
extension=php_soap.dllis Enabled?