API Reference
API Reference

Not all of ShippingEasy's APIs are available via methods in the library. The ShippingEasy_ApiRequestor class, however, can be used to make requests and it handles the signing of the request with your API key and API secret.

For example, to create an EasyShip session:

<?php include './lib/ShippingEasy.php'; $secret = "c2286793830dd8bf0f44c2e6b0fd8bed0e95a36d9ca8f0447de9ff5720cd"; $apiKey = "ebfef8ffe4aac8d4d8dd4f61b62e871"; $method = "post"; $path = "/partners/api/sessions"; $tmptimestamp = time(); $params = array("api_key" => $apiKey, "api_timestamp" => $tmptimestamp); $json_body = array("session" => array("email" => "merchant@myemail.com", "name" => "Merchant Company Name", "external_identifier" => "43295")); $sear = new ShippingEasy_ApiRequestor(); $res = $sear->request($method, $path, $params, $json_body, $apiKey, $secret); echo "<br/><pre>"; print_r($res); echo "</pre><br/><br/>"; ?>

To access the PDF of an EasyShip shipping label (from the EasyShip server callback):

<?php include './lib/ShippingEasy.php'; $secret = "c2286793830dd8bf0f44c2e6b0fd8bed0e95a36d9ca8f0447de9ff5720c58d"; $apiKey = "ebfef8ffe4aac8d4d8dd4f61b62e871"; $method = "get"; $path = "/partners/api/labels/4ca622c3a7f2a383c263ee58bfd43b13f288c66b2b63684"; $tmptimestamp = time(); $params = array("api_key" => $apiKey, "api_timestamp" => $tmptimestamp); $sear = new ShippingEasy_ApiRequestor(); $res = $sear->request($method, $path, $params, NULL, $apiKey, $secret); echo "<br/><pre>"; print_r($res); echo "</pre><br/><br/>"; ?>

To create a ShippingEasy account:

<?php include './lib/ShippingEasy.php'; $secret = "d7ea64a26b6276150e0f8cf06e15df55bfde465de1e870bab143f7978319d2"; $apiKey = "dfaf30a31ed52255f3ef7d0f9ba6216"; $method = "post"; $path = "/partners/api/accounts"; $tmptimestamp = time(); echo "Timestamp: |" . $tmptimestamp . "|<br/><br/>"; $params = array("api_key" => $apiKey, "api_timestamp" => $tmptimestamp); $json_body = array("account" => array("email" => "heberr@kuhlman.net", "first_name" => "Bonita", "last_name" => "Yundt", "company_name" => "Emard, Becker and Morissette", "phone_number" => "7871287490", "address" => "97509 Littel Throughway", "state" => "AA", "postal_code" => "46183", "country" => "Moldova", "password" => "abc123", "subscription_plan_code" => "basic", "city" => "North Marielastad")); $sear = new ShippingEasy_ApiRequestor(); $res = $sear->request($method, $path, $params, $json_body, $apiKey, $secret); ?>

To get the list of stores in a ShippingEasy account:

<?php include './lib/ShippingEasy.php'; $secret = "52950302eb92883a335ea87df4e2524ba867453d6f1c5e78db2912121"; $apiKey = "55927788798c188a5dd1858eff525a4"; $method = "get"; $path = "/api/stores"; $tmptimestamp = time(); $params = array("api_key" => $apiKey, "api_timestamp" => $tmptimestamp); $sear = new ShippingEasy_ApiRequestor(); $res = $sear->request($method, $path, NULL, NULL, $apiKey, $secret); echo "<br/><pre>"; print_r($res); echo "</pre><br/><br/>"; ?>