Inhalte aufrufen

Profilbild

Create new customer via Web API

webapi

  • Bitte melden Sie sich an, um eine Antwort zu verfassen.
1 Antwort zu diesem Thema

#1 profnimrod

profnimrod

    Advanced Member

  • Members
  • PunktPunktPunkt
  • 39 Beiträge

Geschrieben: 06 October 2021 - 18:23

Is there a way to create a new customer via the Web API (4.1.1.0) with a password?
 
I've tried several ways to create a customer via the Web API, but no luck. I think it is the password that is the problem. Is there a method where I can include customer details and password in one call? I really don't want to have to make changes directly in the database.
 
Thanks, Kurt

  • GalenKa und RidgeOi gefällt das

#2 Marcus Gesing

Marcus Gesing

    SmartStore AG

  • Administrators
  • 3831 Beiträge

Geschrieben: 12 October 2021 - 11:04

A customer record can be created by a request like this:
POST http://www.my-shop.com/odata/v1/Customers
{"CustomerGuid":"67ebb40a-fa3d-4243-a53b-6487f894847a","Username":"my@email.com","Email":"my@email.com","AdminComment":"","IsTaxExempt":false,"AffiliateId":0,"Active":true,"IsSystemAccount":false,"SystemName":null,"LastIpAddress":null,"CreatedOnUtc":"2020-10-12T10:00:00.913Z","LastLoginDateUtc":"2020-10-12T10:00:00.913Z","LastActivityDateUtc":"2020-10-12T10:00:00.913Z","Title":null,"FirstName":"John","LastName":"Doe","FullName":"John Doe","Company":"","CustomerNumber":null,"BirthDate":null,"Gender":null,"VatNumberStatusId":10,"TimeZoneId":"W. Europe Standard Time","TaxDisplayTypeId":0,"LastForumVisit":null,"LastUserAgent":null,"LastUserDeviceType":null}
Password data is stored in fields "Password", "PasswordFormatId" and "PasswordSalt" according to this code. For security reasons this data is not transmitted via the API. You have to also provide a CustomerRoleMapping for the registered customer role. I have never tried to import password data via the API. The regular way would be to ask the customer to enter a new password instead of importing it.

  • GalenKa und RidgeOi gefällt das

Marcus Gesing

Smartstore AG



Auch markiert mit einem oder mehrerer dieser Schlüsselwörter: webapi