Skip to main content Link Menu Expand (external link) Document Search Copy Copied

Module: Mage_Sales

Resource: sales_order

Aliases:

  • order
Method:
  • sales_order.list (SOAP V1)
  • salesOrderList (SOAP V2)

Allows you to retrieve the list of orders. Additional filters can be applied.

Aliases:

  • order.list
  • salesOrderList (SOAP V2 method name)

Arguments:

TypeNameDescription
stringsessionIdSession ID
arrayfiltersArray of filters for the list of sales orders (optional)

Returns:

TypenameDescription
arrayresultArray of salesOrderEntity

The salesOrderEntity content is as follows:

TypeNameDescription
stringincrement_idIncrement ID
stringparent_idParent ID
stringstore_idStore ID
stringcreated_atDate of creation
stringupdated_atDate of updating
stringis_activeDefines whether the order is active
stringcustomer_idCustomer ID
stringtax_amountTax amount
stringshipping_amountShipping amount
stringdiscount_amountDiscount amount
stringsubtotalSubtotal sum
stringgrand_totalGrand total sum
stringtotal_paidTotal paid
stringtotal_refundedTotal refunded
stringtotal_qty_orderedTotal quantity ordered
stringtotal_canceledTotal canceled
stringtotal_invoicedTotal invoiced
stringtotal_online_refundedTotal online refunded
stringtotal_offline_refundedTotal offline refunded
stringbase_tax_amountBase tax amount
stringbase_shipping_amountBase shipping amount
stringbase_discount_amountBase discount amount
stringbase_subtotalBase subtotal
stringbase_grand_totalBase grand total
stringbase_total_paidBase total paid
stringbase_total_refundedBase total refunded
stringbase_total_qty_orderedBase total quantity ordered
stringbase_total_canceledBase total canceled
stringbase_total_invoicedBase total invoiced
stringbase_total_online_refundedBase total online refunded
stringbase_total_offline_refundedBase total offline refunded
stringbilling_address_idBilling address ID
stringbilling_firstnameFirst name in the billing address
stringbilling_lastnameLast name in the billing address
stringshipping_address_idShipping address ID
stringshipping_firstnameFirst name in the shipping address
stringshipping_lastnameLast name in the shipping address
stringbilling_nameBilling name
stringshipping_nameShipping name
stringstore_to_base_rateStore to base rate
stringstore_to_order_rateStore to order rate
stringbase_to_global_rateBase to global rate
stringbase_to_order_rateBase to order rate
stringweightWeight
stringstore_nameStore name
stringremote_ipRemote IP
stringstatusOrder status
stringstateOrder state
stringapplied_rule_idsApplied rule IDs
stringglobal_currency_codeGlobal currency code
stringbase_currency_codeBase currency code
stringstore_currency_codeStore currency code
stringorder_currency_codeOrder currency code
stringshipping_methodShipping method
stringshipping_descriptionShipping description
stringcustomer_emailEmail address of the customer
stringcustomer_firstnameCustomer first name
stringcustomer_lastnameCustomer last name
stringquote_idShopping cart ID
stringis_virtualDefines whether the product is a virtual one
stringcustomer_group_idCustomer group ID
stringcustomer_note_notifyCustomer notification
stringcustomer_is_guestDefines whether the customer is a guest
stringemail_sentDefines whether the email notification is sent
stringorder_idOrder ID
stringgift_message_idGift message ID
stringgift_messageGift message

Examples

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

// If somestuff requires API authentication,
// then get a session token
$session = $client->login('apiUser', 'apiKey');

$result = $client->call($session, 'order.list');
var_dump ($result);
Request Example SOAP V2
$params = array(array(
            'filter' => array(
                array(
                    'key' => 'status',
                    'value' => 'pending'
                ),
                array(
                    'key' => 'created_at',
                    'value' => '2001-11-25 12:12:07',
                )
            ),
            'complex_filter' => array(
                array(
                    'key' => 'order_id',
                    'value' => array(
                        'key' => 'in',
                        'value' => '12,23'
                    ),
                ),
                array(
                    'key' => 'protect_code',
                    'value' => array(
                        'key' => 'eq',
                        'value' => 'ebb2a0'
                    ),
                ),
            )
        ));

$result = $client->__call('salesOrderList', $params);
Request Example SOAP V2 (Simple Filter)
$client = new SoapClient('http://magentohost/api/v2_soap/?wsdl');

// If some stuff requires API authentication,
// then get a session token
$session = $client->login('apiUser', 'apiKey');
$filter = array('filter' => array(array('key' => 'status', 'value' => 'closed')));
$result = $client->salesOrderList($session, $filter);

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->salesOrderList((object)array('sessionId' => $sessionId->result, 'filters' => null));   
var_dump($result->result);
XML SOAP V2 Example

SOAP “v2” XML Request

<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="urn:Magento"
                   xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                   xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
                   SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
    <SOAP-ENV:Body>
        <ns1:salesOrderList>
            <sessionId xsi:type="xsd:string">abbc417256a3ffb93d130a77a2fd3665</sessionId>
            <filters xsi:type="ns1:filters">
                <filter SOAP-ENC:arrayType="ns1:associativeEntity[2]" xsi:type="ns1:associativeArray">
                    <item xsi:type="ns1:associativeEntity">
                        <key xsi:type="xsd:string">status</key>
                        <value xsi:type="xsd:string">pending</value>
                    </item>
                    <item xsi:type="ns1:associativeEntity">
                        <key xsi:type="xsd:string">created_at</key>
                        <value xsi:type="xsd:string">2011-11-29 15:41:11</value>
                    </item>
                </filter>
                <complex_filter SOAP-ENC:arrayType="ns1:complexFilter[2]" xsi:type="ns1:complexFilterArray">
                    <item xsi:type="ns1:complexFilter">
                        <key xsi:type="xsd:string">order_id</key>
                        <value xsi:type="ns1:associativeEntity">
                            <key xsi:type="xsd:string">in</key>
                            <value xsi:type="xsd:string">Array</value>
                        </value>
                    </item>
                    <item xsi:type="ns1:complexFilter">
                        <key xsi:type="xsd:string">protect_code</key>
                        <value xsi:type="ns1:associativeEntity">
                            <key xsi:type="xsd:string">in</key>
                            <value xsi:type="xsd:string">a4ffa8</value>
                        </value>
                    </item>
                </complex_filter>
            </filters>
        </ns1:salesOrderList>
    </SOAP-ENV:Body>
</SOAP-ENV:Envelope>