Magento 2.x API – Fix for Forgot Password Not Working

apimagento2

I need to reset the password[Forgot Password] using below REST API,

URL : {{base_url}}/index.php/rest/V1/customers/password

Method : PUT

body :

{
    "email": "test@gmail.com",
    "template": "Forgot Password",
    "websiteId": 0
}

Getting the below response,

{
  "message": "No such entity with %fieldName = %fieldValue, %field2Name = %field2Value",
  "parameters": {
    "fieldName": "email",
    "fieldValue": "test@gmail.com",
    "field2Name": "websiteId",
    "field2Value": 0
  }
}

Please help me?

Best Answer

It is working when i give template as email_reset

{
   "email": "test@email.com",
   "template": "email_reset",
   "websiteId": 1
}

[The documentation for this api not correct."email_reset" is not real template which you can create in admin. It is constant which I found in AccountManagenet.php]

Refer