Magento 2.1 - Cant update Customer Custom Attribute via REST

1.2k views Asked by At

I am trying to update a Custom Attribute in a Customer

However the PUT request is not working...

{
"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"
    }       
]

}

Endpoint ..../rest/V1/customers/111

There's an existing post Magento 2 REST API Customer Custom Attribute which seems to conclude that this is not possible

As it is a bit old I was wandering if anybody was able to get this working... Thanks

1

There are 1 answers

0
Beto Castillo On

I was facing the same issue, but I solved it easily just changing the custom_attributes node inside the main body.

{
"customer": {
    "email":"[email protected]",
    "firstname":"Roberto Carlos",
    "lastname":"Castillo",
    "storeId": 1,
    "websiteId":1,
    "gender":"1",
    "custom_attributes" : [
            {"attribute_code" : "foo", "value" : "bar" }
    ]
},
"password":"Test12345"

}