To retrieve multiple orders, call the findAll()
method on the Order resource class.
$order = new ShippingEasy_Order();
$order->findAll();
If successful the call will return a JSON hash included an array of orders and a hash metadata detailing the conditions used in the search as well as pagination details regarding the response.
Filtering Parameters
page | Integer The page to return in the paginated result set. |
per_page | Integer The number of result to include per pagein the paginated result set. Defaults to 50 if not specified and the maximum number of results returned per page is 200. |
last_updated_at | Datetime Filters the results by the orders' last updated at timestamp and only returns results with a timestamp newer than or equal to the specified value. Defaults to 1 week ago if not specified. The maxiumum time this value can be set to is 3 months ago. |
status | String or Array Filters the results by the orders' ShippingEasy order status. Defaults to "shipped". Possible values: shipped ready_for_shipment pending cleared drop_shipped split combined pending_external_fulfillment It is possible to pass an array of statuses, e.g. ["shipped", "ready_for_shipment"]. Note: There are a few additional states that are used internally as orders are processed, but they are not meant for API consumption. |
includes | Adds information to the response. Specifying includes=products will deliver additional information (if available) about each product in the order. |
order_number | The external_order_identifier to search for |
tags | String or Array Filters the results by tags that have been applied to the order. Specifying one or more tags limits the results to only orders that have at least one of the specified tags. |
Filtering Example
$order = new ShippingEasy_Order();
$order->findAll(array("page" => 1, "per_page" => 1, "status" => array("ready_for_shipment", "shipped"), "last_updated_at" => "2014-05-07 14:42:18 UTC"));
An example JSON response may be found here:
https://gist.github.com/twmills/005b3c4ab9c85330a801
Filtering by Store Example
If you would like to filter your results to a specific store, initialize your object with the store api key:
$order = new ShippingEasy_Order("d8821dde1d32f408def40b77273d5c11");
$order->findAllByStore(array("page" => 1, "per_page" => 1, "status" => array("ready_for_shipment", "shipped"), "last_updated_at" => "2014-05-07 14:42:18 UTC"));
Possible Exceptions
ShippingEasy_AuthenticationError
Your credentials could not be authenticated.
ShippingEasy_InvalidRequestError
The orders retrieved for one or more of the following reasons:
- The API timestamp could not be parsed.
The exception will contain a message that indicates which of these conditions failed.