Muhsin Muhsin - 1 month ago 14
PHP Question

Forgot password API is not working in magento 2.x

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


Getting the below response,

{
"message": "Invalid value of \"%value\" provided for the %fieldName field.",
"parameters": {
"value": "Forgot Password",
"fieldName": "email type"
}
}


Please help me?

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