1

Is there an way such that i can add 100 items in a go through a single API call.Am a .Net developer new to Magento API.Am using Magento SOAP V2.

i am able to create single items.I check the method "catalogProductCreate" and can see that it accepts only one element of "catalogProductCreateEntity" at a time.Can some one please help.

  • You. Can create script for mass omport product – Keyul Shah Feb 3 '14 at 17:34
  • @KeyulShah can you please point me to some example script? – Karthik Feb 3 '14 at 17:37
  • hope you read the data form csv file then you have to read line by line and then after create the object of soap client and with that you can save product each time . – Keyul Shah Feb 4 '14 at 4:30
  • @KeyulShah yup am doing that now.So for hundred items i have to call catalogProductCreate 100 times am i right ?Just wanted to know if i can create hundred items in a single api call – Karthik Feb 4 '14 at 5:12
  • yes you are right not that is not possible you have to call each time and save your product – Keyul Shah Feb 4 '14 at 5:16
1

The SOAP V2 API does not allow you to do that.
You can do that in V1 through the method multiCall. This allows you to send an array of calls to be made at once.
Here is a small example. Sorry it's PHP. I don't have one for .NET

$result = $client->multiCall($session, array(
     array('somestuff.method'),
     array('somestuff.method', 'arg1'),
     array('somestuff.method', array('arg1', 'arg2'))
));

Unfortunately the V1 API is ugly and not that developer friendly.

-2

add the below script to and file.php in root folder and execute it. it is sample script modify it for create a loop for mass product creation

<?php 
error_reporting(E_ALL | E_STRICT);
$mageFilename = 'app/Mage.php';
require_once $mageFilename;
Mage::setIsDeveloperMode(true);
umask(0);
Mage::app();
Mage::app()->setCurrentStore(Mage::getModel('core/store')->load(Mage_Core_Model_App::ADMIN_STORE_ID)); 


//$product = Mage::getModel('catalog/product'); 
$product = new Mage_Catalog_Model_Product(); 

// Build the product 
$product->setSku('some-sku-value-here'); 
$product->setAttributeSetId('9');# 9 is for default 
$product->setTypeId('simple'); 
$product->setName('Some cool product name'); 
$product->setCategoryIds(array(42)); # some cat id's, 
$product->setWebsiteIDs(array(1)); # Website id, 1 is default 
$product->setDescription('Full description here'); 
$product->setShortDescription('Short description here'); 
$product->setPrice(39.99); # Set some price

//Default Magento attribute 
$product->setWeight(4.0000); 

$product->setVisibility(Mage_Catalog_Model_Product_Visibility::VISIBILITY_BOTH); 
$product->setStatus(1); 
$product->setTaxClassId(0); # default tax class 
$product->setStockData(array( 
'is_in_stock' => 1, 
'qty' => 99999 
)); 

$product->setCreatedAt(strtotime('now')); 

try { 
$product->save(); 
} 
catch (Exception $ex) { 
//Handle the error 
} 

?> 
  • it looks like you misread the title the OP put. The OP wants to import products using Magento APIv2 ;) – Julien Lachal Mar 14 '14 at 13:41

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.