0

I am calling this endpoint /rest/V1/customers/me to change user password thorugh PUT request with request body:

   {
   "customer": {
       "firstname": "abc",
       "lastname": "abc",
       "email":"rrr@gmail.com",
       "website_id": 0,
       "addresses": [
           {
               "region": {
                   "region_code": "21",
                   "region": "Pakistan",
                   "region_id": 92
               },
               "region_id": 92,
               "country_id": "PK",
               "street": [
                   "assa"
               ],
               "city": "lahore",
               "firstname": "def",
               "lastname": "def",
               "telephone": "98798798798",
               "postcode": "987987",

               "default_shipping": true,
               "default_billing": true

           }
       ],
       "passwordHash"  : "Admin123123"

   }
   }

I am getting this error:

"message": "Internal Error. Details are available in Magento log file. Report ID: webapi-5cacb11c9a67c

When i've checked the magento log file it shows me this exception:

Message: Property "PasswordHash" does not have accessor method "getPasswordHash" in class "Magento\Customer\Api\Data\CustomerInterface"

I have seen this ref but it didn't works for me. Magento 2: Property does not have accessor method in class "Magento\Checkout\Api\Data\ShippingInformationExtensionInterface

Please help!

  • why would you want to do this?!?! – Philipp Sander Apr 9 '19 at 15:03
0

You should use the dedicated endpoint to change the password

<route url="/V1/customers/me/password" method="PUT">

Example Body:

{ "currentPassword": "string", "newPassword": "string" }

  • Bro thanks for your reply ... we need to use the same endpoint – Hasan Ilyas Apr 9 '19 at 15:09
  • no.... don't do this! use the ones you are supposed to use! also as stated in the word "hash" is that it's something generated. so you can' pass a plain text into this – Philipp Sander Apr 9 '19 at 15:12
-1

I'm having the same issue trying to create customer accounts (for importing and testing purposes). I have generated a correctly hashed password but recieve the same error:

Report ID: webapi-5d1daf169fdd6; Message: Property "PasswordHash" does not have accessor method "getPasswordHash" in class "Magento\Customer\Api\Data\CustomerInterface". {"exception":"[object] (Exception(code: 0): Report ID: webapi-5d1daf169fdd6; Message: Property \"PasswordHash\" does not have accessor method \"getPasswordHash\" in class \"Magento\Customer\Api\Data\CustomerInterface\". at /vendor/magento/framework/Webapi/ErrorProcessor.php:206, LogicException(code: 0): Property \"PasswordHash\" does not have accessor method \"getPasswordHash\" in class \"Magento\Customer\Api\Data\CustomerInterface\". at /vendor/magento/framework/Reflection/NameFinder.php:100)"}

This is the payload being sent to the rest/V1/customers/me endpoint:

{
    "customer": {
        "group_id": 1,
        "email": "importtest@testemail.co.uk",
        "firstname": "John",
        "lastname": "Smith",
        "store_id": 1,
        "website_id": 1,
        "addresses": [
            {
                "region": {
                    "region_code": "Edinburgh",
                    "region": "Edinburgh"
                },
                "country_id": "GB",
                "street": [
                    "1 Haggis Road"
                ],
                "telephone": "07777454545",
                "postcode": "EH10 1AA",
                "city": "Edinburgh",
                "firstname": "John",
                "lastname": "Smith",
                "default_billing": true,
                "default_shipping": true
            }
        ],
        "disable_auto_group_change": 0,
        "passwordHash": "9dce90d384b9882b7a67710e2c66ba3c42c8b230aa227b8074cd9413604c22df:wYp9suAxdO1ZdPpcRwgKcKyjr6xdWaI1:1"
    }
}

The password that has been hashed is M9b@WZ7C using the Salt wYp9suAxdO1ZdPpcRwgKcKyjr6xdWaI1.

Any ideas?

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.