rest - Magento 2.1 - 无法通过 REST 更新客户自定义属性
问题描述
我正在尝试更新客户中的自定义属性
但是 PUT 请求不起作用...
{
"customer":{
"id":111,
"group_id": 1,
"email":"abcd@com",
"firstname": "first",
"lastname": "last",
"taxvat": "123456789",
"website_id": 1
},
"custom_attributes":
[
{
"attribute_code": "customer_erp_id",
"value": "66666"
}
]
}
端点 ..../rest/V1/customers/111
有一个现有的帖子Magento 2 REST API Customer Custom Attribute 似乎得出的结论是这是不可能的
因为它有点老了,我在徘徊,如果有人能够让这个工作......谢谢
解决方案
我遇到了同样的问题,但我只需更改主体内的 custom_attributes 节点即可轻松解决。
{
"customer": {
"email":"roberto@test.com.mx",
"firstname":"Roberto Carlos",
"lastname":"Castillo",
"storeId": 1,
"websiteId":1,
"gender":"1",
"custom_attributes" : [
{"attribute_code" : "foo", "value" : "bar" }
]
},
"password":"Test12345"
}
推荐阅读
- database - 具有动态表和列的 Spring Boot JPA
- mysql - 如何在多个数据库中将所有表引擎从 MISAM 更改为 INNODB?
- javafx - 使用 ArcGIS Java SDK 绘制圆形/矩形形状
- python-3.x - 使用python集成for和if循环
- java - 从java中获取函数并在php中编写相同的函数但不起作用
- recursion - Paul Graham 如何在他的 Bel 参考文献中解决 mac 的循环问题?
- c++ - QT如何将Qlist传递给类构造函数
- php - 双引号保存为“e;在mysql中使用php pdo保存时
- google-bigquery - 在 Google BigQuery 中将十六进制转换为二进制
- ios - NSFetchedResultsController - 不调用委托函数