Shipment API
Table of Contents
Allows create/export order shipments.
Module: Mage_Sales
Resource: sales_order_shipment
Aliases:
- order_shipment
Methods |
sales_order_shipment.list |
Retrieve list of shipments by filters
Return: array
Arguments:
- array filters - filters for invoices list
Aliases:
- order_shipment.list
sales_order_shipment.info |
Retrieve shipment information
Return: array
Arguments:
- string shipmentIncrementId - order shipment increment id
Aliases:
- order_shipment.info
sales_order_shipment.create |
Create new shipment for order
Return: string - shipment increment id
Arguments:
- string orderIncrementId - order increment id
- array itemsQty - items qty to ship as associative array (order_item_id ⇒ qty)
- string comment - shipment comment (optional)
- boolean email - send e-mail flag (optional)
- boolean includeComment - include comment in e-mail flag (optional)
Aliases:
- order_shipment.create
sales_order_shipment.addComment |
Add new comment to shipment
Return: boolean
Arguments:
- string shipmentIncrementId - shipment increment id
- string comment - shipment comment
- boolean email - send e-mail flag (optional)
- boolean includeInEmail - include comment in e-mail flag (optional)
Aliases:
- order_shipment.addComment
sales_order_shipment.addTrack |
Add new tracking number
Return: int
Arguments:
- string shipmentIncrementId - shipment increment id
- string carrier - carrier code
- string title - tracking title
- string trackNumber - tracking number
Aliases:
- order_shipment.addTrack
sales_order_shipment.removeTrack |
Remove tracking number
Return: boolean
Arguments:
- string shipmentIncrementId - shipment increment id
- int trackId - track id
Aliases:
- order_shipment.removeTrack
sales_order_shipment.getCarriers |
Retrieve list of allowed carriers for order
Return: array
Arguments:
- string orderIncrementId - order increment id
Aliases:
- order_shipment.getCarriers
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);




