I can't seem to find a way to get the shipping address for an order though the REST API. Does anyone have an idea?

4 Answers 4


Looks like methods for retrieval of order addresses are not exposed via web API for some reason. You can expose them in you module simply by declaring in VendorName/ModuleName/etc/webapi.xml:

<?xml version="1.0"?>
<routes xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    <route url="/V1/orderAddresses" method="GET">
        <service class="Magento\Sales\Api\OrderAddressRepositoryInterface" method="getList"/>
            <resource ref="Magento_Sales::sales" />

Then use search criteria to specify filter by parent_id (as for any other list operation)

  • I'm running into the same problem, however, I'm not that much of a Magento module developer. All I need to do is obtain orders from Magento in C#. Can you explain in a bit more detail what I need to do to expose the missing API or where I have to put above lines exactly? Commented Feb 8, 2016 at 16:30
  • 1
    If it is possible in your case, I would recommend to wait for Magento 2.1.0 release in April, this web API should be available then. If not, look for how to create new Magento module on Magento dev docs, and then expose missing API as described in current answer. Commented Feb 9, 2016 at 6:52
  • Thank you! This worked for me as well. Any idea what would happen if our customer updates Magento to a version where the API is published by default? Would there be a problem or would it continue working? If we disabled the module I've just created, would that be enough? Commented Feb 9, 2016 at 11:15
  • 1
    It will depend how it will be exposed by the Magento team (new interface might be introduced). However, you should still be able to use your endpoint, just make sure to use unique resource name, which will not conflict with the core one, e.g. /V1/yourModuleNameOrderAddresses. Commented Feb 9, 2016 at 11:20

You can also get the shipping address via the extension attributes of the order (that you have gotten via rest)

  1. Transform your order object to an array

    $magentoOrder = json_decode(json_encode($magentoOrderStd), true);
  2. Use this function to extract the shipping address

    private function getShippingAddressFromExtensionAttributes($magentoOrder)
       if (!isset($magentoOrder['extension_attributes']['shipping_assignments'])) return null;
       $shippingAssignments = $magentoOrder['extension_attributes']['shipping_assignments'];
       foreach ($shippingAssignments as $shippingAssignment) {
          if (!isset($shippingAssignment['shipping']['address'])) continue;
          return $shippingAssignment['shipping']['address'];
       return null;

It works well for me, but it can be, that it doesn't work with all shipping method. If there will occur any issue, I will let you know here.


You can get an order with /V1/orders/<id> then check order["extension_attributes"]["shipping_assignments"][0]["shipping"]["address"].

This is for example what I use with PyMagento (disclaimer: I’m the author):

import magento

client = magento.Magento(...)

order = client.get_order_by_increment_id("2001234567")
shipping_address = magento.get_order_shipping_address(order)
orderExtensionFactory = $orderExtensionFactory; } public function afterGet( OrderRepositoryInterface $subject, OrderInterface $order ) { $orderExtensionAttribute = (null !== $order->getExtensionAttributes()) ? $order->getExtensionAttributes() : $this->orderExtensionFactory->create(); if (!$order->getIsVirtual()) { $shippingAddress = $order->getShippingAddress()->getData(); $orderExtensionAttribute->setShippingAssignments([$shippingAddress]); } return $order; } } > setShippingAssignments -> set value in setShippingAssignments method then only custom value will show in order Rest API

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.