BETA

Importing Customers

This page documents the API under the customer endpoint /{projectKey}/customers. Namely, we document CustomerImportRequest and the endpoint methods for ImportOperations for Customers.

CustomerImportRequest

Representations

CustomerImportRequest

An import request for multiple customer import resources.

type
String
"customer"

The customer import resource type.

resources

The customer import resources of this request.

MaxItems: 20
Example: json
{
"type" : "customer",
"resources" : [ {
"key" : "keycustomertest",
"firstName" : "Alice",
"lastName" : "Doe",
"email" : "alice@example.org",
"password" : "secret"
} ]
}

CustomerImport

Import representation for a customer.

key
String
customerNumber
String

Maps to Customer.customerNumber.

email
String

Maps to Customer.email.

password
String

Maps to Customer.password.

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.

externalId
String

Maps to Customer.externalId.

dateOfBirth
Date

Maps to Customer.dateOfBirth.

companyName
String

Maps to Customer.companyName.

vatId
String

Maps to Customer.vatId.

isEmailVerified
Boolean

Maps to Customer.isEmailVerified.

References a customer group by its key.

The customer group referenced must already exist in the commercetools project, or the import operation state is set to Unresolved.

addresses
Array of Address

Maps to Customer.addresses.

defaultBillingAddress

Maps to Customer.defaultBillingAddress.

billingAddresses

Maps to Customer.billingAddresses.

defaultShippingAddress

Maps to Customer.defaultShippingAddress.

shippingAddresses

Maps to Customer.shippingAddresses.

locale
String

Maps to Customer.locale.

custom

The custom fields for this Customer.

Endpoints

Request Customer Data to be Imported

Creates import request for creating new customers or updating existing ones.

POST
https://import.europe-west1.gcp.commercetools.com/{projectKey}/customers/importSinkKey={importSinkKey}
OAuth 2.0 Scopes:
manage_customers:{projectKey}, manage_project:{projectKey}
Path Parameters:
projectKey
String
The commercetools project key.
importSinkKey
String
The import sink used to create the new resource
Response:

201ImportResponse

Request Example:cURL
curl -X POST https://import.europe-west1.gcp.commercetools.com/{projectKey}/customers/importSinkKey={importSinkKey} -i \
--header 'Authorization: Bearer ${BEARER_TOKEN}' \
--header 'Content-Type: application/json' \
--data-binary @- << DATA
{
"type" : "customer",
"resources" : [ {
"key" : "keycustomertest",
"firstName" : "Alice",
"lastName" : "Doe",
"email" : "alice@example.org",
"password" : "secret"
} ]
}
DATA

Get ImportOperations

Get ImportOperations by an ImportSink Key

Retrieves all customer import operations of an import sink key.

GET
https://import.europe-west1.gcp.commercetools.com/{projectKey}/customers/importSinkKey={importSinkKey}/import-operations
OAuth 2.0 Scopes:
manage_customers:{projectKey}, view_customers:{projectKey}, manage_project:{projectKey}
Path Parameters:
projectKey
String
The commercetools project key.
importSinkKey
String
The import sink used to create the new resource
Query Parameters:
limit
Float
-
offset
Float
-
resourceKey
String
The key of the import operation to retrieve.
state
The state of the import operations to retrieve.
Request Example:cURL
curl -X GET https://import.europe-west1.gcp.commercetools.com/{projectKey}/customers/importSinkKey={importSinkKey}/import-operations -i \
--header 'Authorization: Bearer ${BEARER_TOKEN}'

Get an ImportOperation by its ID

Retrieves the import operation with the given id.

GET
https://import.europe-west1.gcp.commercetools.com/{projectKey}/customers/importSinkKey={importSinkKey}/import-operations/{id}
OAuth 2.0 Scopes:
manage_customers:{projectKey}, view_customers:{projectKey}, manage_project:{projectKey}
Path Parameters:
projectKey
String
The commercetools project key.
importSinkKey
String
The import sink used to create the new resource
id
String
The operation identifier
Response:
Request Example:cURL
curl -X GET https://import.europe-west1.gcp.commercetools.com/{projectKey}/customers/importSinkKey={importSinkKey}/import-operations/{id} -i \
--header 'Authorization: Bearer ${BEARER_TOKEN}'
Response Example:json
{
"version" : 1,
"state" : "Unresolved",
"importSinkKey" : "category-import-sink",
"resourceKey" : "child-category",
"resourceType" : "category",
"resourceAsString" : "'{}'",
"id" : "252c6ed3-c668-4610-afe9-87b9255e62e0",
"createdAt" : "2018-02-05T09:47:16.648Z",
"lastModifiedAt" : "2018-02-05T09:47:16.649Z",
"expiresAt" : "2018-02-08T09:47:16.649Z",
"retryCount" : 0,
"unresolvedReferences" : [ {
"typeId" : "category",
"key" : "my-parent-category-key"
} ]
}