EDIT: I made changes to my discussion of IsEmailAvailable to correct an error in my assumption as to how that works.
I am unsuccessfully trying to get Magento Commerce 2.3.6 (on Adobe Commerce Cloud) to send a password reset link email using the REST API. Using Swagger:
swagger#/customerAccountManagementV1/customerAccountManagementV1InitiatePasswordResetPut
which calls the rest endpoint:
/rest/all/V1/customers/password
I get one of two results. If I use "websiteId": 0, then the result is a status of 404 and the response body is:
{
"message": "No such entity with %fieldName = %fieldValue, %field2Name = %field2Value",
"parameters": {
"fieldName": "email",
"fieldValue": "magento@example.com",
"field2Name": "websiteId",
"field2Value": 0
}
}
If I use "websiteId": 1, then the result is a status of 502 and the response body is HTML with a heading of:
<h1>502 Bad Gateway</h1>
The websiteId should be 1. Note that
swagger#/customerAccountManagementV1/customerAccountManagementV1IsEmailAvailablePost
which calls the rest endpoint
/rest/all/V1/customers/isEmailAvailable
with a request of:
{
"customerEmail": "mark@redquark.com",
"websiteId": 1
}
returns "200 false" (indicating the email address is in use for this store and therefore not available for new accounts), but if I change the websiteId to 0 then it returns "200 true" instead (the email address is available for use in this store and therefore not associated with an account). So a 404 (not found) makes sense for websiteId = 0.
So, here are the questions:
- Should the websiteId for requesting Magento send out an email with a password reset link be 0 or 1?
- How to fix the 404 (if websiteId = 0) or 502 (if websiteId = 1) error such that the REST API request actually works?
- If 404 is correct for websiteId = 0, why does the request work for websiteId = 0 but throw a 502 Bad Gateway error for websiteId = 1? If I can get a result for one store, why not the other?
Thank you for your time and assistance!