使用休息Magento2获取客户的所有地址

时间:2018-02-16 09:16:49

标签: magento2 customer-account-data-api

如何使用休息Magento2获取客户的所有地址?是否有开箱即用的API?

1 个答案:

答案 0 :(得分:2)

是的,鉴于您有客户ID:

GET /V1/customers/{customerId}

这将返回所有客户地址

"customer": 
{
  "id": 0,
  "default_billing": "string",
  "default_shipping": "string",
  "addresses": [
    {
      "id": 0,
      "customer_id": 0,
      "region": {
        "region_code": "string",
        "region": "string",
        "region_id": 0,
        "extension_attributes": {}
      },
      "region_id": 0,
      "country_id": "string",
      "street": [
        "string"
      ]
    }
  ]
}