$client = new SoapClient($host . '/api/v2_soap/?wsdl');
$session = $client->login($apiUser, $apiKey);
$result = $client->catalogInventoryStockItemMultiUpdate($session, 'sku_id1',
array('qty' => 1), null, 'sku');
$result = $client->catalogInventoryStockItemMultiUpdate($session, 'sku_id1',
array('qty' =>2), null, 'sku');
How use function catalogInventoryStockItemMultiUpdate()
or other decision to call several functions one request ?
Example only for the soap v1 but not the soap v2.
Answering this for those who arrive at it from Google. The v2 Magento Api does not have a multicall function. The v1 API does.
Here is a codesnippet from the API v1 documentation demonstrating how to make multiple calls at once:
$client = new SoapClient('http://magentohost/soap/api/?wsdl');
// If somestuff requires api authentification,
// then get a session token
$session = $client->login('apiUser', 'apiKey');
$result = $client->call($session, 'somestuff.method');
$result = $client->call($session, 'somestuff.method', 'arg1');
$result = $client->call($session, 'somestuff.method', array('arg1', 'arg2', 'arg3'));
$result = $client->multiCall($session, array(
array('somestuff.method'),
array('somestuff.method', 'arg1'),
array('somestuff.method', array('arg1', 'arg2'))
));
// If you don't need the session anymore
$client->endSession($session);
The requests must still be created and queued one by one, but at least you save yourself the time it takes to send requests one after the other.
In the tools that I have, I use a combination of the v1 and v2 api for making bulk updates and selective updates. The v1 API can likely do everything you require, just not WSI compliant.