1

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": "[email protected]",
     "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

6
  • 1
    Try V1/customers/me with customer token in authorisation header. Sep 9, 2019 at 16:12
  • Did you get solution as Ramkishan mentioned or? Sep 10, 2019 at 5:19
  • What params need to be passed in request? Sep 10, 2019 at 5:19
  • @AnkitaPatel Not yet. Sep 10, 2019 at 5:19
  • @RamkishanSuthar Already try but not working. Sep 16, 2019 at 13:08

1 Answer 1

4

Request URL: http://localhost/magento/rest/en/V1/customers/55

Body :

{
   "customer": {
     "id":55,
     "email": "[email protected]",
     "firstname": "firstname new",
     "lastname":  "lastname new",
     "website_id": 1
   }
}

Add here ID field to update existing customer, also add all required fiels in payload.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.