Magento 2: Rest API “PUT” method Customer is not updated
-
12-03-2021 - |
سؤال
Rest API for updating customer PUT
method not working. Every time creating new customer.
Method: PUT
Request URL: http://localhost/magento/rest/en/V1/customers/55
Body:
{
"customer": {
"email": "test@gmail.com",
"firstname": "firstname new",
"lastname": "lastname new",
"website_id": 1
}
}
Also when pass the customer Email Id then response is throwing below error.
Response:
{
"message": "A customer with the same email address already exists in an associated website."
}
Github Issue URL:
https://github.com/magento/magento2/issues/24625
المحلول
Request URL: http://localhost/magento/rest/en/V1/customers/55
Body :
{
"customer": {
"id":55,
"email": "test@gmail.com",
"firstname": "firstname new",
"lastname": "lastname new",
"website_id": 1
}
}
Add here ID field to update existing customer, also add all required fiels in payload.
لا تنتمي إلى magento.stackexchange