Importing Customers
This endpoint can be used to import Customer data to create and update Customers in a commercetools Project. The Customer data to import is represented by CustomerImport and loaded in CustomerImportRequest, which is posted to import Customers.
To monitor an import status, use Get ImportSummary, Get ImportOperation, and Query ImportOperations.
Representations
CustomerImportRequest
The request body to import Customers. Contains data for Customers to be created or updated in a commercetools Project.
typeString | "customer"The customer import resource type. |
resourcesArray of CustomerImport | The customer import resources of this request. MaxItems:20 |
{"type" : "customer","resources" : [ {"customerNumber" : "12345","email" : "alice@example.org","password" : "secret","firstName" : "Alice","lastName" : "Doe","middleName" : "Ruth","title" : "Ms.","dateOfBirth" : "1980-01-01","companyName" : "commercetools GmbH","vatId" : "123456789","addresses" : [ {"key" : "wCVKP6iU","firstName" : "Alice","country" : "DE"}, {"key" : "en-wcvK6","firstName" : "Alice","country" : "US"} ],"defaultShippingAddress" : 0,"shippingAddresses" : [ 0, 1 ],"defaultBillingAddress" : 0,"billingAddresses" : [ 0, 1 ],"isEmailVerified" : false,"externalId" : "external-id-123","customerGroup" : {"typeId" : "customer-group","key" : "customer-group-key"},"custom" : {"type" : {"key" : "custom-type","typeId" : "type"},"fields" : {"boolean-field" : {"type" : "Boolean","value" : true}}},"locale" : "DE","salutation" : "Dr.","key" : "customer-import-resource-key","stores" : [ {"typeId" : "store","key" : "store-key"} ]} ]}
CustomerImport
The data representation for a Customer to be imported that is persisted as a Customer in the Project.
keyString | |
customerNumberString | Maps to |
emailString | Maps to |
passwordString | Maps to |
storesArray of StoreKeyReference | The References to the Stores with which the Customer is associated. If referenced Stores do not exist, the |
firstNameString | Maps to |
lastNameString | Maps to |
middleNameString | Maps to |
titleString | Maps to |
salutationString | Maps to |
externalIdString | Maps to |
dateOfBirthDate | Maps to |
companyNameString | Maps to |
vatIdString | Maps to |
isEmailVerifiedBoolean | Maps to |
customerGroup | The Reference to the CustomerGroup with which the Customer is associated.
If referenced CustomerGroup does not exist, the |
addressesArray of CustomerAddress | Maps to |
defaultBillingAddressInt | The index of the address in the addresses array. The |
billingAddressesArray of Integer | The indices of the billing addresses in the addresses array. The |
defaultShippingAddressInt | The index of the address in the addresses array. The |
shippingAddressesArray of Integer | The indices of the shipping addresses in the addresses array. The |
localeString | Maps to |
custom | The custom fields for this Customer. |
CustomerAddress
Different from Address in that key is required and id is not supported.
keyString | User-defined identifier for the address.
Must follow the pattern |
titleString | |
salutationString | |
firstNameString | |
lastNameString | |
streetNameString | |
streetNumberString | |
additionalStreetInfoString | |
postalCodeString | |
cityString | |
regionString | |
stateString | |
countryCountryCode | A two-digit country code as per ISO 3166-1 alpha-2. |
companyString | |
departmentString | |
buildingString | |
apartmentString | |
pOBoxString | |
phoneString | |
mobileString | |
emailString | |
faxString | |
additionalAddressInfoString | |
externalIdString |
Import Customers
Creates a request for creating new Customers or updating existing ones.
manage_customers:{projectKey}regionString | The Region in which the Project is hosted. |
projectKeyString | The commercetools Project key. |
importContainerKeyString | The ImportContainer used to create the new resource |
curl -X POST https://import.{region}.commercetools.com/{projectKey}/customers/import-containers/{importContainerKey} -i \--header 'Authorization: Bearer ${BEARER_TOKEN}' \--header 'Content-Type: application/json' \--data-binary @- << DATA{"type" : "customer","resources" : [ {"customerNumber" : "12345","email" : "alice@example.org","password" : "secret","firstName" : "Alice","lastName" : "Doe","middleName" : "Ruth","title" : "Ms.","dateOfBirth" : "1980-01-01","companyName" : "commercetools GmbH","vatId" : "123456789","addresses" : [ {"key" : "wCVKP6iU","firstName" : "Alice","country" : "DE"}, {"key" : "en-wcvK6","firstName" : "Alice","country" : "US"} ],"defaultShippingAddress" : 0,"shippingAddresses" : [ 0, 1 ],"defaultBillingAddress" : 0,"billingAddresses" : [ 0, 1 ],"isEmailVerified" : false,"externalId" : "external-id-123","customerGroup" : {"typeId" : "customer-group","key" : "customer-group-key"},"custom" : {"type" : {"key" : "custom-type","typeId" : "type"},"fields" : {"boolean-field" : {"type" : "Boolean","value" : true}}},"locale" : "DE","salutation" : "Dr.","key" : "customer-import-resource-key","stores" : [ {"typeId" : "store","key" : "store-key"} ]} ]}DATA