Magento 2 REST API客户自定义属性

编程入门 行业动态 更新时间:2024-10-14 22:17:26
本文介绍了Magento 2 REST API客户自定义属性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

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客户自定义属性

本文发布于:2023-11-28 16:04:37,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1643065.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:自定义   属性   客户   Magento   REST

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!