cancel
Showing results for 
Search instead for 
Did you mean: 

m2.2.5-dev-mode rest API post problem

m2.2.5-dev-mode rest API post problem

Hi all,
I just came over some rest API problems:
I do a post to add a product and I can't  insert 'qty' and other values into system. Also categries are the same. And all setting are "copied" from a GUI-inserted product, so they should be ok. All goes fine, but response show for ex. NULL for qty., and it's really lost in space...
Am I missing something or is this a bug ? I have now tested all I can figure out...

br. Mike

Heres the post payload:
post:{"product":{"sku":"24523746122","name":"Sample2","price":20,"status":1,"attribute_set_id":4,"weight":0.65,"visibility":4,"type_id":"simple"},"extension_attributes":{"category_links":[{"position":0,"category_id":"3"}],"stock_item":{"stock_id":"1","qty":"27","is_in_stock":"1","use_config_manage_stock":1,"manage_stock":1,"min_sale_qty":1,"use_config_min_qty":"true","use_config_backorders":"true","min_qty":0}}}

And here's the result:
array (
  
'id' => 41,
  
'sku' => '24523746122',
  
'name' => 'Sample2',
  
'attribute_set_id' => 4,
  
'price' => 20,
  
'status' => 1,
  
'visibility' => 4,
  
'type_id' => 'simple',
  
'created_at' => '2018-08-28 23:19:32',
  
'updated_at' => '2018-08-28 23:19:34',
  
'weight' => 0.65,
  
'extension_attributes' => 
  array (
    
'website_ids' => 
    array (
      
=> 1,
    ),
    
'stock_item' => 
    array (
      
'item_id' => 27,
      
'product_id' => 41,
      
'stock_id' => 1,
      
'qty' => NULL,
      
'is_in_stock' => false,
      
'is_qty_decimal' => false,
      
'show_default_notification_message' => false,
      
'use_config_min_qty' => true,
      
'min_qty' => 0,
      
'use_config_min_sale_qty' => 1,
      
'min_sale_qty' => 1,
      
'use_config_max_sale_qty' => true,
      
'max_sale_qty' => 10000,
      
'use_config_backorders' => true,
      
'backorders' => 1,
      
'use_config_notify_stock_qty' => true,
      
'notify_stock_qty' => 1,
      
'use_config_qty_increments' => true,
      
'qty_increments' => 0,
      
'use_config_enable_qty_inc' => true,
      
'enable_qty_increments' => false,
      
'use_config_manage_stock' => true,
      
'manage_stock' => true,
      
'low_stock_date' => '2018-08-28 23:19:34',
      
'is_decimal_divided' => false,
      
'stock_status_changed_auto' => 1,
    ),
  ),
  
'product_links' => 
  array (
  ),
  
'options' => 
  array (
  ),
  
'media_gallery_entries' => 
  array (
  ),
  
'tier_prices' => 
  array (
  ),
  
'custom_attributes' => 
  array (
    
=> 
    array (
      
'attribute_code' => 'options_container',
      
'value' => 'container2',
    ),
    
=> 
    array (
      
'attribute_code' => 'url_key',
      
'value' => 'sample2',
    ),
    
=> 
    array (
      
'attribute_code' => 'required_options',
      
'value' => '0',
    ),
    
=> 
    array (
      
'attribute_code' => 'has_options',
      
'value' => '0',
    ),
    
=> 
    array (
      
'attribute_code' => 'tax_class_id',
      
'value' => '2',
    ),
    
=> 
    array (
      
'attribute_code' => 'quantity_and_stock_status',
      
'value' => 
      array (
        
=> false,
        
=> NULL,
      ),
    ),
    
=> 
    array (
      
'attribute_code' => 'category_ids',
      
'value' => 
      array (
      ),
    ),
  ),
);
?>


1 REPLY 1

Re: m2.2.5-dev-mode rest API post problem

Hi all,

I noticed that my account was mangled up...

Sorry about that, should be ok now.