Magento API

SOAP

About Magento API

Module: Mage_Sales

The Mage_Sales module allows you to manage sales orders, invoices, shipments, and credit memos.

Shipment

Allows you to manage shipments and tracking numbers.

Resource Name: sales_order_shipment

Aliases:

  • order_shipment

Methods:

Faults

Fault Code Fault Message
100 Requested shipment not exists.
101 Invalid filters given. Details in error message.
102 Invalid data given. Details in error message.
103 Requested order not exists.
104 Requested tracking not exists.
105 Tracking not deleted. Details in error message.

Examples

Example 1. Basic working with shipments
$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
$sessionId = $proxy->login('apiUser', 'apiKey');

$notShipedOrderId  = '100000003';

// Create new shipment
$newShipmentId = $proxy->call($sessionId, 'sales_order_shipment.create', array($notShipedOrderId, array(), 'Shipment Created', true, true));

// View new shipment
$shipment = $proxy->call($sessionId, 'sales_order_shipment.info', $newShipmentId);

var_dump($shipment);


// Get allowed carriers for shipping
$allowedCarriers = $proxy->call($sessionId, 'sales_order_shipment.getCarriers', $notShipedOrderId);

end($allowedCarriers);

$choosenCarrier = key($allowedCarriers);

var_dump($allowedCarriers);
var_dump($choosenCarrier);

// Add tracking
$newTrackId = $proxy->call($sessionId, 'sales_order_shipment.addTrack', array($newShipmentId, $choosenCarrier, 'My Track', rand(5000, 9000)));

$shipment = $proxy->call($sessionId, 'sales_order_shipment.info', $newShipmentId);

var_dump($shipment);