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 name | type | description |
---|---|---|
id | integer | The ID of the customer |
referenceKey | string | External reference set by the client to integrate a third party system |
firstName | string | First name of the customer |
lastName | string | Last name of the customer |
gender | string | Gender of the customer mentioned as per defined ENUM as "m", "f", "d" |
birthDate | string | Date of birth of the customer in YYYY-MM-DD format |
string | Email address of the customer | |
phone | string | Phone number of the customer |
publicKey | string | Public reference set by the client to display to customers in account areas and transactional emails |
title | string | User-defined title. It can be set to NULL otherwise |
type | string | Type of customer (like personal) |
groups | string | Group to which the customer belongs to |
status | CustomerStatus | Defines if the customer is active or not and if the customer is a guest customer or not |
company | Company | Company to which the customer belongs to |
addresses | CustomerAddress | Customer's addresses |
legacyCustomData | array | Custom data added to the customer (legacy feature) |
createdAt | string | Timestamp when the customer is created |
updatedAt | string | Timestamp 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);