【发布时间】:2016-10-10 07:24:39
【问题描述】:
如何使用 REST API 更新/添加客户的 EAV 属性?
我尝试使用带有此 URL 的 [PUT] /V1/customers/{id} 来做到这一点
http://<website>/rest/V1/customers/1
这是正文数据:
$data = array(
'customer' => array(
'id' => 1,
'email' => 'email@domain.com',
'firstname' => 'John',
'lastname' => 'Doe',
'website_id' => 1,
'custom_attributes' => array(
'attribute_code' => 'my_custom_attribute_code',
'value' => 'my_custom_attribute_value'
)
)
);
我能够编辑客户的默认属性,例如 firstname 和 lastname,但我无法编辑 EAV 属性。
是否可以使用默认的customerCustomerRepositoryV1 接口来做到这一点?
如果没有,您如何扩展以便可以编辑/添加客户的 EAV 属性?
谢谢。
Magento 2.1 Rest API 接口: http://devdocs.magento.com/swagger
【问题讨论】: