Hello Magento Friends,
Hope you are doing great! Again I am up with a new tutorial blog on SOAP API for Magento 2. This time it is about fetching shipment details through SOAP API in Magento 2.
SOAP API helps to build connections between your Magento platform and external systems. Shipping information of the order is to be given to the courier service provider for delivery. You can Create Shipment Programmatically or Create Shipment using API in Magento 2. So, when you need shipping information outside the Magento system you can fetch it using SOAP API.
Let’s get moving,
Step 1: Create a getshipmentinfo.php file anywhere and add the following code:
<?php $request = new SoapClient("http://yourdomain/index.php/soap/?wsdl&services=integrationAdminTokenServiceV1", array("soap_version" => SOAP_1_2)); $token = $request->integrationAdminTokenServiceV1CreateAdminAccessToken(array("username" => "admin", "password" => "admin123")); $request = new SoapClient( 'http://yourdomain/index.php/soap/default?wsdl&services=salesShipmentRepositoryV1', array( 'soap_version' => SOAP_1_2, 'stream_context' => stream_context_create(array( 'http' => array('header' => 'Authorization: Bearer ' . $token->result) )) ) ); try { $response = $request->salesShipmentRepositoryV1Get(array('id' => 4)); } catch (Exception $e) { echo "<pre>"; print_r($e->getMessage()); exit; } echo "<pre>"; print_r($response); ?>
Accordingly, you can get shipment information using SOAP API in Magento 2. If you have any doubts, share with me via the comment section.
Happy Coding!
Hello Magento Friends, In Magento 2, customizations to the admin panel can significantly enhance the…
Hello Magento Friends, Magento 2 provides a robust event-driven architecture that allows developers to observe…
Hyvä is gradually gaining popularity in this current market, and even 3.5% of Magento websites…
In today’s fast-paced society, where convenience and safety are paramount, curbside pickup has emerged as…
Have you ever observed how complementary and similar items are often displayed together in brick-and-mortar…
You may be familiar with Hyvä, the frontend theme for Magento 2, which has been…