Magento API

SOAP

About Magento API

Module: Mage_Sales

Resource: sales_order_shipment

Aliases:

  • order_shipment
Method:
  • sales_order_shipment.create (SOAP V1)
  • salesOrderShipmentCreate (SOAP V2)

Allows you to create a new shipment for an order.

Aliases:

  • order_shipment.create

Arguments:

Type Name Description
string sessionId Session ID
string orderIncrementId
Order increment ID
array itemsQty
Array of orderItemIdQty (optional)
string comment
Shipment comment (optional)
int email
Send email flag (optional)
int includeComment
Include comment in email flag (optional)

Returns:

Type Name Description
string shipmentIncrementId
Shipment increment ID

The orderItemIdQty content is as follows:

Type Name Description
int order_item_id
Order item ID
double qty
Quantity of items to be shipped

Notes: The array of orderItemQty is used for partial shipment. To create shipment for all order items, you do not need to specify these attributes.

Examples

Request Example SOAP V1
$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');

$session = $proxy->login('apiUser', 'apiKey');
var_dump ($session);

$orderIncrementId = '200000006';
$itemsQty = array('3' => '3', '4' => '5');

$result = $proxy->call(
    $session,
    'order_shipment.create',
    array(
        $orderIncrementId,
        $itemsQty
    )
);

var_dump ($result);
Request Example SOAP V2
$proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary

$result = $proxy->salesOrderShipmentCreate($sessionId, '200000006', array('8', '1'), 'shipment comment');
var_dump($result);
Request Example SOAP V2 (WS-I Compliance Mode)
$proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); 

$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey')); 
 
$result = $proxy->salesOrderShipmentCreate((object)array('sessionId' => $sessionId->result, 'orderIncrementId' => '200000006', 'itemsQty' => array('order_item_id' => '8', 'qty' => '1'), 'comment' => 'shipment comment', 'email' => null, 'includeComment' => null));   
var_dump($result->result);