4
$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

4

1 Answer 1

3

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,

...
1
  • How to send 'qty' => '30.0000' Please? Feb 19, 2018 at 20:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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