Representations
CustomerImportRequest
type | customer The resource types that can be imported. |
resources Array of CustomerImport | The customer import resources of this request. MaxItems:20 |
{
"type": "customer",
"resources": [
{
"customerNumber": "12345",
"email": "alice@example.com",
"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": {
"exampleBooleanField": {
"type": "Boolean",
"value": true
}
}
},
"locale": "DE",
"salutation": "Dr.",
"key": "customer-import-resource-key",
"stores": [
{
"typeId": "store",
"key": "store-key"
}
],
"authenticationMode": "Password"
}
]
}
CustomerImport
key String | User-defined unique identifier. If a Customer with this MinLength: key exists, it will be updated with the imported data.2 MaxLength: 256 Pattern: ^[A-Za-z0-9_-]+$ |
customerNumber String | Maps to Customer.customerNumber . |
externalId String | Maps to Customer.externalId . |
email String | Maps to Customer.email . |
password String | Required when authenticationMode is set to Password . Maps to Customer.password . |
stores Array of StoreKeyReference | The References to the Stores with which the Customer is associated. If referenced Stores do not exist, the state of the ImportOperation will be set to unresolved until the necessary Stores are created. |
firstName String | Maps to Customer.firstName . |
lastName String | Maps to Customer.lastName . |
middleName String | Maps to Customer.middleName . |
title String | Maps to Customer.title . |
salutation String | Maps to Customer.salutation . |
dateOfBirth Date | Maps to Customer.dateOfBirth . |
companyName String | Maps to Customer.companyName . |
vatId String | Maps to Customer.vatId . |
isEmailVerified Boolean | Maps to Customer.isEmailVerified . |
customerGroup | The Reference to the CustomerGroup with which the Customer is associated.
If referenced CustomerGroup does not exist, the state of the ImportOperation will be set to unresolved until the necessary CustomerGroup is created. |
addresses Array of CustomerAddress | Maps to Customer.addresses . |
defaultBillingAddress Int | The index of the address in the addresses array. The defaultBillingAddressId of the customer will be set to the ID of that address. |
billingAddresses Array of Integer | The indices of the billing addresses in the addresses array. The billingAddressIds of the customer will be set to the IDs of that addresses. |
defaultShippingAddress Int | The index of the address in the addresses array. The defaultShippingAddressId of the customer will be set to the ID of that address. |
shippingAddresses Array of Integer | The indices of the shipping addresses in the addresses array. The shippingAddressIds of the customer will be set to the IDs of that addresses. |
locale String | Maps to Customer.locale . |
authenticationMode |
Password |
custom | The Custom Fields for this Customer. |
CustomerAddress
key String | User-defined identifier for the address.
Must follow the pattern [a-zA-Z0-9_-]{2,256} and must be unique per customer. |
externalId String | ID for the contact used in an external system. |
country | Name of the country. Pattern:^[A-Z]{2}$ |
title String | Title of the contact, for example 'Dr.' |
salutation String | Salutation of the contact, for example 'Mr.' or 'Ms.' |
firstName String | Given name (first name) of the contact. |
lastName String | Family name (last name) of the contact. |
streetName String | Name of the street. |
streetNumber String | Street number. |
additionalStreetInfo String | Further information on the street address. |
postalCode String | Postal code. |
city String | Name of the city. |
region String | Name of the region. |
state String | Name of the state, for example, Colorado. |
company String | Name of the company. |
department String | Name of the department. |
building String | Number or name of the building. |
apartment String | Number or name of the apartment. |
pOBox String | Post office box number. |
phone String | Phone number of the contact. |
mobile String | Mobile phone number of the contact. |
email String | Email address of the contact. |
fax String | Fax number of the contact. |
additionalAddressInfo String | Further information on the Address. |
custom | Custom Fields for the address. |
Import Customers
Creates a request for creating new Customers or updating existing ones.
manage_customers:{projectKey}
region String | The Region in which the Project is hosted. |
projectKey String | The Project key. |
importContainerKey String | The ImportContainer used to create the new resource |
application/json
ImportResponse
application/json
curl 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.com",
"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" : {
"exampleBooleanField" : {
"type" : "Boolean",
"value" : true
}
}
},
"locale" : "DE",
"salutation" : "Dr.",
"key" : "customer-import-resource-key",
"stores" : [ {
"typeId" : "store",
"key" : "store-key"
} ],
"authenticationMode" : "Password"
} ]
}
DATA
{
"operationStatus": [
{
"state": "processing",
"operationId": "252c6ed3-c668-4610-afe9-87b9255e62e0"
}
]
}