Hello Magento Friends,

In today’s blog, I will explain How to Get a Custom Attribute Value of Shipment using REST API in Magento 2.

In Magento 2, a shipment represents the process of sending goods to customers. Shipment entities are rich with data, and businesses often extend these entities with custom attributes to capture additional information relevant to their operations. These custom attributes could range from batch numbers to packaging details.

The REST API in Magento 2 provides a standardized way to interact with the platform, allowing developers to create, read, update, and delete various entities, including shipments.

Let’s find out How to Get Custom Attribute Value of Shipment using REST API in Magento 2.

Steps to Get Custom Attribute Value of Shipment using REST API in Magento 2:

Step 1: Create extension_attributes.xml file inside etc folder

app\code\Vendor\Extension\etc\

And add the below code

Step 2: Now, create di.xml file inside the etc folder

app\code\Vendor\Extension\etc\

Then add the code as follows

Step 3: Then create ShipmentRepository.php file inside the Plugin folder.

app\code\Vendor\Extension\Plugin\Api\

After that, include the below-mentioned code

Step 4: Now, need to run the below command

Then, you can see the values ​​of the custom attributes from the URL below.

BASE_URL/rest/all/V1/shipment/increment_id

Conclusion:

By following the steps outlined in this blog post, you can unlock the full potential of Magento 2 and provide a more personalized and efficient e-commerce experience for your customers. 

Also find out,

If you have any doubt share it with me through the comment section.

Happy Coding!

Click to rate this post!
[Total: 0 Average: 0]