How to Update Tracking on a Magento API
Magento's application programming interface provides you with the ability to develop and manage both custom and existing resources for your Magento storefront. You can manage your store's customers, inventory and edit its shopping carts. The API awards you with advanced control over your store's shipping as well, allowing you to make adjustments to every facet of an outgoing order. And if you need to update the tracking order on a shipment, use the Magento API to tag the order with the right number.
Instructions
-
-
1
Launch web browser, and then connect to your Magento Soap site. Type "http://hostsite/api/?wsdl" into the browser's address bar, and then hit the "Enter" button on your keyboard -- substitute "hostsite" with your site's domain.
-
2
Type "$proxy = new SoapClient('http://host/api/soap/?wsdl');" into the first line of the site's console to connect to the Magento API. Substitute "host" with the domain of your Magento host site.
-
-
3
Type "$sessionId = $proxy->login('User', 'Pass')" on the next line to enter your credentials. Substitute "User" and "Pass" with your username and password.
-
4
Specify your order, by typing "$notShipedOrderId = 'ordernumber';" onto the next line. Replace "ordernumber" with the number of the targeted order. Type "$Tracking_number = value" onto the next line. Replace "value" with the updated tracking number.
-
5
Type "$newTrackId = $proxy->call($sessionId, 'sales_order_shipment.addTrack', array($newShipmentId, $choosenCarrier, 'My Track', rand(5000, 9000)));" onto the next two lines. Replace "My Track" with a title for your tracking number.
-
6
Type "$shipment = $proxy->call($sessionId, 'sales_order_shipment.info', $newShipmentId);" and "var_dump($shipment);" onto the next two lines of the console to enforce your new tracking number.
-
7
Enter "$client->endSession($session);" onto the next line to end your Magento API session.
-
1