docs
  1. SCAYLE Resource Center
  2. Developer Guides
  3. Customer
  4. Import Customers

Import Customers

SCAYLE allows you to create a customer.

About this Method

This method is used to create a new customer.

Method Signature

let response = await adminApi.apis.Customers.createCustomer({shopKey: shopKey, countryCode: countryCode}, {requestBody: customer});
let customer = response.body;

Parameters

param nametypedescription
idintegerThe ID of the customer
referenceKeystringExternal reference set by the client to integrate a third party system
firstNamestringFirst name of the customer
lastNamestringLast name of the customer
genderstringGender of the customer mentioned as per defined ENUM as "m", "f", "d"
birthDatestringDate of birth of the customer in YYYY-MM-DD format
emailstringEmail address of the customer
phonestringPhone number of the customer
publicKeystringPublic reference set by the client to display to customers in account areas and transactional emails
titlestringUser-defined title. It can be set to NULL otherwise
typestringType of customer (like personal)
groupsstringGroup to which the customer belongs to
statusCustomerStatusDefines if the customer is active or not and if the customer is a guest customer or not
companyCompanyCompany to which the customer belongs to
addressesCustomerAddressCustomer's addresses
legacyCustomDataarrayCustom data added to the customer (legacy feature)
createdAtstringTimestamp when the customer is created
updatedAtstringTimestamp when the customer is updated

Create a Customer

let customer = {
     "firstName": "John",
     "lastName": "Doe",
     "title": "Prof.",
     "gender": "m",
     "birthDate": "1980-01-01",
     "email": "[email protected]",
     "phone": "0049/1234567890",
     "publicKey": "pubKey-123",
     "referenceKey": "refKey-456"
};

let response = await adminApi.apis.Customers.createCustomer({shopKey: 'ms', countryCode: 'DE'}, {requestBody: customer});
customer = response.body;

console.log(customer.id);

Create with Groups

Create a customer with groups.

let customer = {
  "firstName": "John",
  "lastName": "Doe",
  "title": "Prof.",
  "gender": "m",
  "birthDate": "1980-01-01",
  "email": "[email protected]",
  "phone": "0049/1234567890",
  "publicKey": "customer-1234",
  "groups": [
    "employee"
  ]
};

let response = await adminApi.apis.Customers.createCustomer({shopKey: 'ms', countryCode: 'DE'}, {requestBody: customer});
customer = response.body;

console.log(customer.id);