Shipment API

Last modified by Ruslan Voitenko on Mon, March 16, 2009 10:58
Source|Old Revisions  

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 shipments 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

  1. $proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
  2. $sessionId = $proxy->login('apiUser', 'apiKey');
  3.  
  4. $notShipedOrderId  = '100000003';
  5.  
  6. // Create new shipment
  7. $newShipmentId = $proxy->call($sessionId, 'sales_order_shipment.create', array($notShipedOrderId, array(), 'Shipment Created', true, true));
  8.  
  9. // View new shipment
  10. $shipment = $proxy->call($sessionId, 'sales_order_shipment.info', $newShipmentId);
  11.  
  12. var_dump($shipment);
  13.  
  14.  
  15. // Get allowed carriers for shipping
  16. $allowedCarriers = $proxy->call($sessionId, 'sales_order_shipment.getCarriers', $notShipedOrderId);
  17.  
  18. end($allowedCarriers);
  19.  
  20. $choosenCarrier = key($allowedCarriers);
  21.  
  22. var_dump($allowedCarriers);
  23. var_dump($choosenCarrier);
  24.  
  25. // Add tracking
  26. $newTrackId = $proxy->call($sessionId, 'sales_order_shipment.addTrack', array($newShipmentId, $choosenCarrier, 'My Track', rand(5000, 9000)));
  27.  
  28. $shipment = $proxy->call($sessionId, 'sales_order_shipment.info', $newShipmentId);
  29.  
  30. var_dump($shipment);



 

Magento 2 GitHub Repository

Magento Job Board - Some sort of tag line goes here

Latest Posts| View all Jobs