Export Customers
General
You can also request several customers. We suggest to fine-tune your search, e.g., by combing filter logics and using pagination. As search results are paginated, you can set the amount of customers displayed per page.
Admin API
About this Method
This method can be used to get a collection of customers for any given shop and country. It is possible to refine the search by applying filter options.
This method might be disabled by default. Please approach the respective SCAYLE Account Manager for activation.
Method Signature
let response = await adminApi.apis.Customers.getCustomers({shopKey: shopKey, countryCode: countryCode});
let customers = response.body.entities;
Options
The operation can be used with optional parameters - called options:
Parameter | Details |
---|---|
with | String Allows to load the following nested resources within this request:
|
limit | Integer Maximum number of items in the result. (default: |
filters[referenceKey] | String Comma-separated list of reference keys that should be used for filtering. |
filters[id] | String Comma-separated list of customer IDs that should be used for filtering. |
filters[minId] | Integer Minimum (inclusive) customer ID of entities that should be returned. |
filters[maxId] | Integer Maximum (inclusive) customer ID of entities that should be returned. |
filters[minCreatedAt] | String Minimum (inclusive) creation date of customer that should be returned. |
filters[maxCreatedAt] | String Maximum (inclusive) creation date of customers that should be returned. |
filters[minUpdatedAt] | String Minimum (inclusive) modification date of customers that should be returned. |
filters[maxUpdatedAt] | String Maximum (inclusive) modification date of customers that should be returned. |
filters[billingAddressCountryCode] | String Only returns customers with the given billingAddress country code. |
filters[shippingAddressCountryCode] | String Only returns customers with the given shippingAddress country code. |
filters[group] | String Comma-separated list of customer groups that should be used for filtering. |
filters[isActive] | Boolean Pass true to get only active customer, pass false to get the opposite. |
sort | String Sort by the provided column. Available values: id (default), appId, birthDate, firstName, lastName, lastInvoiceDate, lastLoginDate, lockedUntilDate, passwordResetRequestedAt, createdAt, updatedAt. |
sortDir | String Defines the sorting order: ascending or descending. Available values: asc (default), desc. |
Parameters
Parameter | Details |
---|---|
entities | Customer A collection of customers. |
cursor | Cursor An object containing information for use in pagination. |
Examples
Get a list of Customers
let response = await adminApi.apis.Customers.getCustomers({shopKey: 'ms', countryCode: 'DEU'});
let customers = response.body.entities;
customers.forEach(
customer => console.log(customer.id)
);
Read with Options
Get a Customer with Addresses and filtered by ids:
let response = await adminApi.apis.Customers.getCustomers({
shopKey: 'ms',
countryCode: 'DEU',
with: 'addresses',
"filters[id]": "10,11,12"
});
let customers = response.body.entities;
customers.forEach(
customer => customer.addresses.forEach(address => console.log(address.id))
);