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": "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

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

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.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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