Magento 2 REST API文档介绍了一种在更新或创建客户时在客户上设置custom_attributes的方法. devdocs.magento/swagger/index_20.html#/
The Magento 2 REST API Documentation explains a way to set custom_attributes on a customer when updating or creating it. devdocs.magento/swagger/index_20.html#/
不幸的是,我无法使它正常工作...
Unfortunately I couldn't get this to work...
我的POST和PUT JSON请求数据是:
My POST and PUT JSON request data is :
{ "customer": { "custom_attributes": [ { "attribute_code": "firstname", "value": "TEST" } ], "email": "someone@exaxmple", "extension_attributes": [], "firstname": "Someone", "gender": null, "lastname": "Else", "middlename": null, "taxvat": null, "website_id": "1" } }已创建客户,但名字不是"TEST". 是否有人遇到过相同的问题并已解决?请让我知道如何.
The Customer is created but the Firstname is not "TEST". Is there anyone who had the same problem and fixed it? Please let me know how.
推荐答案我的最佳猜测是,由于Firstname是现有的开箱即用属性-OOTB属性名称-值映射分配将具有优先权
My best guess is that, since Firstname is an existing Out-Of-The-Box attribute - the OOTB attribute name-value mapping assignment will take precedence.
您能否使用唯一的自定义属性名称(即与OOTB属性名称不冲突的名称)重试
Could you try again, with a unique custom attribute name (i.e. something that doesn't clash with OOTB attribute names)
在使用M2 API对该自定义客户属性执行操作之前,您需要先定义一个自定义客户属性.
You will need to DEFINE a custom-customer-attribute before you can use the M2 API to perform operations on that custom-customer-attribute.
此StackExchange线程- magento.stackexchange/questions /88245/magento2-create-a-customer-custom-attribute -有关如何设置自定义客户属性的更多信息.
This StackExchange thread - magento.stackexchange/questions/88245/magento2-create-a-customer-custom-attribute - has additional information on how to go about setting up a custom-customer-attribute.
更多推荐
Magento 2 REST API客户自定义属性
发布评论