3

Can anyone let me know how to use Rest webapi to create new customer account with password? i have used following webapi in postman but it won't allow me to add password field,rest fields working fine, Please do let me know if anyone have done this kind of things.please find screenshot of webapi I have used to create account:

rest/V1/customers

postman api

error log

  • you're passing wrong array key. – Aditya Shah Aug 29 '18 at 6:00
4

Register Customer using API

webapi.xml

<route url="/V1/customers" method="POST">
<service class="Magento\Customer\Api\AccountManagementInterface" method="createAccount"/>
<resources>
    <resource ref="anonymous"/>
</resources>
</route>

url http://<magento-host>/rest/V1/customers

url action :: POST

Body > raw > JSON(application/json)

{
"customer":{
    "email":"Test@example.com",
    "firstname":"Aditya",
    "lastname":"Shah",
    "websiteId":"1",
    "addresses":[
        {
            "customer_id":"1",
            "firstname":"Aditya",
            "lastname":"Shah",
            "company":"ABC Manufacturing",
            "telephone":"555-555-5555",
            "city":"Boston",
            "region":"Massachusetts",
            "postcode":"02115",
            "country_id":"US",
            "street":[
                "404 Main Street",
                "PO Box 321"
            ]
        }
    ]
},
 "password": "Account@123"
}
  • Thanks Aditya, it worked for me, i was putting password field inside customer object as per my understanding, your solution worked like a charm!!!! Thanks a lot. – bhargav shastri Aug 29 '18 at 6:11

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.