Customers API

Overview

This document outlines the purpose, technology, use cases, methods, objects and examples for using the Customers API.

This document focuses on the SOAP interface to this API.

Purpose

The Customers API provides programmatic access to the customer database and allows for control and maintenance of customer data within the system.

The Customers API exposes two primary native interfaces via .NET and SOAP.

Customers API Definition (.NET)

Full documentation for this interface is available in the API Reference.

Customers API Definition (SOAP)

This section documents the SOAP interface to the API.

Endpoint

The SOAP API endpoint for any system is located at https://[siteurl]/global/api/customers.asmx

This endpoint is enabled for access via SOAP as well as HTTP GET and POST. The Service Description is also available directly via this endpoint.

Note: For systems with satellite sites, the API will be available only under the primary site URL.

Security (SOAP Interface Only)

The Customers API via SOAP uses the Permissions System to allow and deny access to users. Use of the API requires a user to be granted the various actions (under iSAMS / API / Customers) to be able to authenticate and perform the various actions available under this API.

Password Requirements

The Customers API supports password protection through a number of common hashing algorithms as well as plaintext passwords. In general, any customer passwords submitted to the Customers API should be in plaintext, and the API will hash the password if and as required. However, if your passwords are protected with an unsupported hash algorithm, you will need to submit passwords in their hashed forms. This API does not currently support encrypted passwords.

The following hashing algorithms are supported:

Customer password handling

The value of the Protected field on a Customer object determines how the Customers API handles customer passwords when creating or updating a customer.

If Protected is false, then the customer's Password is assumed to be in plaintext and will be protected according to the site's password policy (note that this may mean the password is left as plaintext).

If Protected is true, then the customer's Password is assumed to have already been protected according to the site's password policy and will be stored with no modifications.

If a customer's Password field is left blank during an update, then the customer's password will be left unchanged (for existing customers) or will have a random password created (for new customers).

It is up to the caller to ensure these attributes are set correctly for customer data updates.

Note: Plaintext customer passwords will never be returned in any bulk export.

Protected passwords are included in the XML and JSON bulk exports. Customer passwords (whether protected or plaintext) will never be included in the CSV bulk export.

Error Handling

Error handling is primarily left to the caller. Any methods that return an ApiResponse object will provide additional details that can be used to assist when debugging problems.

Where a "Call Identifier" is returned in the Message field of the ApiResponse, then a full exception trace will be available from http://[siteurl]/logs/api/{Call Identifier}.txt

Methods

Available methods are listed below.

Objects

Available objects are listed below.

Examples

Customers API usage examples are available. These examples demonstrate the use of the API via a SOAP interface and are available in C# and Java.

Methods

Authenticate

See Authenticate.

ListCustomers

Lists the Customer IDs of all customers present in the system.

Parameters
Name Type Description
authenticationToken String Authentication token to use for this call.
Response

Returns an IntegerArrayApiResponse containing the Customer IDs of all customers present in the system.

ListCustomersByInterestGroup

Lists the Customer IDs of all customers in the specified interest group.

Parameters
Name Type Description
authenticationToken String Authentication token to use for this call.
interestGroup String The name of the interest group to return customers for.
Response

Returns an IntegerArrayApiResponse containing the Customer IDs of all customers in the specified interest group.

SearchCustomers

Lists the Customer IDs of all customers matching the specified search term(s).

Parameters
Name Type Description
authenticationToken String Authentication token to use for this call.
email String Customer email address search term.
name String Customer name search term.
foreignIdentity String Customer foreign identity search term.
shippingAddress String Customer shipping address search term.
shippingCountry String Customer shipping country search term.
billingAddress String Customer billing address search term.
billingCountry String Customer billing country search term.
Response

Returns an IntegerArrayApiResponse containing the Customer IDs of all customers matching the specified search terms.

Notes

This method will return the Customer IDs of all customers with details matching the input search terms. Results are based on all or part of the individual search terms matching the appropriate customer data.

Where more than one search term is provided, the results will be filtered on all provided search terms.

The name search term will return results based on the customer's first and last names, combined and separated by a space.

The shippingAddress and billingAddress search terms will return results based on the customer's combined street, suburb, city, postcode, state, and extra information address fields, separated by spaces in that order.

The shippingCountry and billingCountry search terms should be standard three-letter country codes (e.g. 'NZL' for 'New Zealand').

Empty, null, or all-whitespace search terms are ignored when filtering results, with the exception of foreignIdentity (where an empty or all-whitespace search term will return all customers with no assigned foreign identity).

ListCustomersCreated

Lists the Customer IDs of all customers created in the specified date range.

Parameters
Name Type Description
authenticationToken String Authentication token to use for this call.
startDate DateTime The start of the date range (inclusive).
endDate DateTime The end of the date range (inclusive).
Response

Returns an IntegerArrayApiResponse containing the Customer IDs of all customers created in the specified date range.
Times must be supplied in UTC.

ListCustomersModified

Lists the Customer IDs of all customers modified in the specified date range.

Parameters
Name Type Description
authenticationToken String Authentication token to use for this call.
startDate DateTime The start of the date range (inclusive).
endDate DateTime The end of the date range (inclusive).
Response

Returns an IntegerArrayApiResponse containing the Customer IDs of all customers modified in the specified date range.
Times must be supplied in UTC.

RetrieveCustomer

Retrieves a customer using the provided Customer ID.

Parameters
Name Type Description
authenticationToken String Authentication token to use for this call.
customerID Integer Customer ID of the customer to retrieve.
Response

Returns a CustomerApiResponse containing a Customer object for the supplied Customer ID as the sole entry in the CustomerApiResponse.Data array.

RetrieveCustomers

Retrieves a set of customers using the Customer IDs provided.

Parameters
Name Type Description
authenticationToken String Authentication token to use for this call.
customerIDs Integer[] Customer IDs of the customers to retrieve.
Response

Returns a CustomerApiResponse containing an array of Customer objects for the supplied Customer IDs in the CustomerApiResponse.Data field.

UpdateCustomer

Adds or updates a single customer.

Parameters
Name Type Description
authenticationToken String Authentication token to use for this call.
customer Customer Customer to add or update.
Response

Returns an ApiReponse indicating the outcome of the call.

Notes

This method is used to both add new and update existing customers. Customers will be added or updated based on their Customer ID. New customers will only be created if their ID field is 0 (zero).

Any fields in the Customer (and associated objects) with lengths longer than the maximum length for that field will be silently truncated. See the individual object documentation for maximum field lengths.

Input fields with invalid values will use default values for new customers and leave the field unchanged for existing customers.

See Password Requirements for information on how passwords are handled in the Customers API.

UpdateCustomers

Adds or updates a set of customers.

Parameters
Name Type Description
authenticationToken String Authentication token to use for this call.
customers Customer[] Customers to add or update.
Response

Returns an ApiReponse indicating the outcome of the call.

Notes

This method functions much like UpdateCustomer, but allows for adding and updating multiple customers at once.

Customers can both be created and updated in the same method call. There is no need to make separate calls to create some customers and update others.

Calling this method once with multiple customers is more efficient than calling UpdateCustomer once for each of those customers.

DeleteCustomer

Deletes a single customer.

Parameters
Name Type Description
authenticationToken String Authentication token to use for this call.
customerID Integer Customer ID of the customer to delete.
Response

Returns an ApiReponse indicating the outcome of the call.

Notes

Deleting a customer is permanent and cannot be undone.

DeleteCustomers

Deletes a set of customers.

Parameters
Name Type Description
authenticationToken String Authentication token to use for this call.
customerIDs Integer[] Customer IDs of the customers to delete.
Response

Returns an ApiReponse indicating the outcome of the call.

Notes

This method functions much like DeleteCustomer, but allows for deleting multiple customers at once.

RetrievePasswordResetUrl

Retrieves a URL that can be used by a customer to reset their password.

Parameters
Name Type Description
authenticationToken String Authentication token to use for this call.
customerID Integer Customer ID of the customer whose password is to be reset.
websiteID Integer Website ID of the website the customer will use to reset their password.
Response

Returns an NVPApiReponse indicating the outcome of the call and containing data necessary to allow a customer to reset their password.

If a password reset URL cannot be generated for a customer for any reason, the operation will fail with a response code of 2000 (invalid data).

The Data field of the response contains NameValuePairs as follows:

Name Value
url The URL a customer needs to visit in order to reset their password.
code A code that the customer must enter in order to reset their password (may be optional - see below).
Notes

Depending on a site's password reset settings, the 'code' may or may not be required. If 'code' is an empty string, then the code is not required to reset the customer's password. If it is populated, the customer will need to enter the supplied code when resetting their password.

Any password reset URL is only valid for one use.

Export

Performs a bulk export of all customer data to a set of CSV/XML/JSON files that can be retrieved via HTTP, with the ability to specify number of records per file, path and file name prefix.

Parameters
Name Type Description
authenticationToken String Authentication token to use for this call.
exportSettings ApiExportSettings Settings for file export
Response

Returns a StringArrayApiResponse indicating the outcome of the call and the filenames of the files generated for the export.

Notes

All customers present in the system will be exported.

Passwords (whether hashed, encrypted, or plaintext) will never be exported as part of a CSV bulk export.

This will export all available customer data for ALL customers in the system, and should be used with caution on systems with large numbers of customers.

Sample

The CSV file format is available here. A sample of the CSV customer export is available here.

ExportXml

Performs a bulk export of specified customer data to a set of XML files that can be retrieved via HTTP.

Parameters
Name Type Description
authenticationToken String Authentication token to use for this call.
customerIDs Integer[] Customer IDs of the customers to export.
Response

Returns a StringArrayApiResponse indicating the outcome of the call and the filenames of the files generated for the export.

Notes

The generated files will be retrievable via https://[siteurl]/data/customers/[filename], where [filename] is provided in the API call response.

All available customer data for the customers specified in customerIDs will be exported.

Each individual export file will contain data for no more than 100 customers. If more than 100 customers are present in an export batch, the export will split the exported customers into multiple export files.

Sample

A sample of the XML customer export is available here.

ExportAllXml

Performs a bulk export of all customer data to a set of XML files that can be retrieved via HTTP.

Parameters
Name Type Description
authenticationToken String Authentication token to use for this call.
Response

Returns a StringArrayApiResponse indicating the outcome of the call and the filenames of the files generated for the export.

Notes

The generated files will be retrievable via https://[siteurl]/data/customers/[filename], where [filename] is provided in the API call response.

All customers present in the system will be exported.

Each individual export file will contain data for no more than 100 customers. If more than 100 customers are present in an export batch, the export will split the exported customers into multiple export files.

This will export all available customer data for ALL customers in the system, and should be used with caution on systems with large numbers of customers.

Sample

A sample of the XML customer export is available here.

ExportJson

Performs a bulk export of specified customer data to a set of JSON files that can be retrieved via HTTP.

Parameters
Name Type Description
authenticationToken String Authentication token to use for this call.
customerIDs Integer[] Customer IDs of the customers to export.
Response

Returns a StringArrayApiResponse indicating the outcome of the call and the filenames of the files generated for the export.

Notes

The generated files will be retrievable via https://[siteurl]/data/customers/[filename], where [filename] is provided in the API call response.

All available customer data for the customers specified in customerIDs will be exported.

Each individual export file will contain data for no more than 100 customers. If more than 100 customers are present in an export batch, the export will split the exported customers into multiple export files.

Sample

A sample of the JSON customer export is available here.

ExportAllJson

Performs a bulk export of all customer data to a set of JSON files that can be retrieved via HTTP.

Parameters
Name Type Description
authenticationToken String Authentication token to use for this call.
Response

Returns a StringArrayApiResponse indicating the outcome of the call and the filenames of the files generated for the export.

Notes

The generated files will be retrievable via https://[siteurl]/data/customers/[filename], where [filename] is provided in the API call response.

All customers present in the system will be exported.

Each individual export file will contain data for no more than 100 customers. If more than 100 customers are present in an export batch, the export will split the exported customers into multiple export files.

This will export all available customer data for ALL customers in the system, and should be used with caution on systems with large numbers of customers.

Sample

A sample of the JSON customer export is available here.

ExportCsv

Performs a bulk export of specified customer data to a set of CSV files that can be retrieved via HTTP.

Parameters
Name Type Description
authenticationToken String Authentication token to use for this call.
customerIDs Integer[] Customer IDs of the customers to export.
Response

Returns a StringArrayApiResponse indicating the outcome of the call and the filenames of the files generated for the export.

Notes

The generated files will be retrievable via https://[siteurl]/data/customers/[filename], where [filename] is provided in the API call response.

All available customer data for the customers specified in customerIDs will be exported.

The export file will contain data for ALL customers in ONE file.

Passwords (whether hashed, encrypted, or plaintext) will never be exported as part of a CSV bulk export.

Sample

The CSV file format is available here. A sample of the CSV customer export is available here.

ExportAllCsv

Performs a bulk export of all customer data to a set of CSV files that can be retrieved via HTTP.

Parameters
Name Type Description
authenticationToken String Authentication token to use for this call.
Response

Returns a StringArrayApiResponse indicating the outcome of the call and the filenames of the files generated for the export.

Notes

The generated files will be retrievable via https://[siteurl]/data/customers/[filename], where [filename] is provided in the API call response.

All customers present in the system will be exported.

The export file will contain data for ALL customers in ONE file.

Passwords (whether hashed, encrypted, or plaintext) will never be exported as part of a CSV bulk export.

This will export all available customer data for ALL customers in the system, and should be used with caution on systems with large numbers of customers.

Sample

The CSV file format is available here. A sample of the CSV customer export is available here.

Objects

All dates and times are in UTC.

ApiExportFormat

File format for the exported file.

Fields/Properties
Field NameTypeDescriptionNotes
CSVintTo export file in CSV format.Default
JSONintTo export file in JSON format.
XMLintTo export file in XML format.

ApiExportSettings

Settings for the records to export.

Fields/Properties
Field NameTypeDescriptionNotes
PathStringPath to save files.Default path is https://[siteurl]/data/customers/[filename], where [filename] is provided in the API call response.
RecordsPerFileintNumber of records to be exported in one file.Default is 100 for JSON and XML, unlimited for CSV.
FormatApiExportFormatFile format for the exported file.
FilenamePrefixStringPrefix for the exported filename.This can be an alphanumeric value, which will be prefixed to the generated file names.Default is blank.
Notes

If RecordsPerFile value is not passed, the default limit for JSON and XML file formats is 100 customers per file and the export will generate multiple files. The default limit for CSV is unlimited, so all customers will be exported in one file.

CustomerApiResponse

Contains basic information about the result of a method call, along with an array of Customer objects.

Fields/Properties
Field NameTypeDescriptionNotes
SuccessBooleanIndicates the success or failure of an API method call.A failure (false) response should contain a failure Code and Message in the respective fields.
CodeIntegerA response code for the method call.
MessageStringMessage or output from the method call.
DataCustomer[]Array of Customer objects returned from the method call.

Customer

Represents a Customer.

Fields/Properties

Others client specific
Field NameTypeDescriptionNotes
IDIntegerThe unique Customer ID of this customer.This is a read-only field.
ForeignIdentityString (50)The foreign identity of this customer.
EmailString (100)The email address of this customer.
TitleString (10)The title of this customer.
FirstNameString (50)The first name of this customer.
LastNameString (50)The last name of this customer.
PhoneString (50)The main phone number for this customer.
FaxString (50)The fax number for this customer.
MobileString (50)The mobile phone number for this customer.
PasswordString (70)This customer's password.See Password Requirements for more information on password handling within the Customer API.
ProtectedBooleanIndicates whether the supplied password has been protected (i.e. hashed or encrypted).If false, the plaintext password will be protected appropriately (hashed, encrypted, or left as plaintext as required) when the customer is created/updated.
LpmStatusIntegerSpecifies if this customer is to receive email marketing.Valid values are:
1 - Normal
2 - Referred - Pending Acceptance
3 - Suspended – Invalid Email
4 - Suspended – Client Request
New clients default to 1 ('Normal') if not specified.
SmsStatusIntegerSpecifies if this customer is to receive SMS marketing.Valid values are:
0 - Inactive
1 - Active
New clients default to 0 ('Inactive') if not specified.
EmailFormatString (5)The customer's preferred email format.Valid values are 'HTML' and 'Text'. New customers default to 'HTML' if not specified.
CustomerTypeIntegerSpecifies the customer typeThis is a read-only field.
Valid values are:
1 - Registered
2 - Guest
PreferencesTokenStringThe encrypted Customer ID of this customer.This is a read-only field.
InterestGroupsString (100)[]The names of the interest groups that this customer is subscribed to.
AccountCustomerAccountThe customer's debit account.
NotesCustomerNote[]The notes entered against this customer.Notes cannot be modified, only created and deleted.
AddressesCustomerAddress[]The customer's addresses.
AttributesNameValuePair[]Additional information attached to this customer.These attributes are arbitrary key-value data pairs stored against a Customer. The Name and Value fields for these NameValuePairs are limited to a length of 100 characters each.
WebsitesInteger[]The website IDs of the websites to which a customer is linked.Once a customer has been linked to a website, the link is permanent and cannot be removed. Linked websites are primarily used when sending CRM emails to customers. Linking a customer to a website does not affect a customer in any way.
See Website ID for more information.
DateCreatedDateTimeThe date this customer was created.This is a read-only field.
DateModifiedDateTimeThe date this customer was last modified.This is a read-only field.
AdditionalDetailsStringContains arbitrary additional details.This field is ignored unless custom processing is required. Expected to contain structured data (e.g. XML, JSON).
Notes

Numbers in parentheses following a type indicate the maximum length of that field. Any values longer than the maximum length will be truncated.

CustomerAccount

A CustomerAccount allows a customer to purchase goods on credit, and may be used to give additional benefits such as discounts.

Fields/Properties
Field NameTypeDescriptionNotes
AccountIDString (50)An identifier for the CustomerAccount.Multiple customers may have the same AccountID.
AccountTypeString (100)The type of the CustomerAccount.The account type will be created if it does not exist.
AccountNameString (100)The name of the CustomerAccount.
DateCreatedDateCreatedThe date this CustomerAccount was created.This is a read-only field.
DiscountDoubleA site-wide discount applied to purchases with this CustomerAccount.This is a percentage, limited to the range 0% (i.e. no discount) to 100%.
FreeFreightBooleanSpecifies if freight will be charged on orders through this CustomerAccount.
Notes

Numbers in parentheses following a type indicate the maximum length of that field. Any values longer than the maximum length will be truncated.

CustomerNote

A CustomerNote is a note placed against a customer by an admin user.

Fields/Properties
Field NameTypeDescriptionNotes
IDIntegerThe unique identifier of this CustomerNote
NoteString (512)The content of this CustomerNote.
DateCreatedDateTimeThe date this CustomerNote was created.
DisplayLevelIntegerDefines where this CustomerNote can be displayed.Valid values are:
2 - Displayed in the admin and Customers API only.
3 - Displayed in all locations, including order progress emails and order history.
This defaults to 2 if not specified when a CustomerNote is created.
Notes

Numbers in parentheses following a type indicate the maximum length of that field. Any values longer than the maximum length will be truncated.

No update functionality is supported with CustomerNote. If a CustomerNote is created in error and should not be displayed then it may be deleted and a new CustomerNote created to correct the error if necessary.

CustomerAddress

Represents a customer address.

Fields/Properties
Field NameTypeDescriptionNotes
IDIntegerA unique identifier for this CustomerAddress.
TypeString (50)The type of this CustomerAddress.A customer can have multiple addresses of type "None". A customer can have either one "Shipping" and one "Billing" address, or one "Primary" address.
TitleString (10)The title for this address.An honorific to be used for this address e.g. Dr., Mrs.
FirstNameString (50)The first name for this address.
LastNameString (50)The last name for this address.
ContactPhoneString (50)The contact phone number for this address.The ContactPhone for an address is independent of the Phone, Fax, and Mobile fields on a Customer.
CompanyString (50)The company for this address.
StreetString (50)The street address portion of this address.
SuburbString (50)The suburb portion of this address.
CityString (50)The city portion of this address.
StateString (50)The state or province portion of this address.
PostcodeString (50)The postcode portion of this address.
CountryString (3)The country portion of this address.This is a standard three-letter country code.
ExtraInformationString (50)An additional address information line.
Notes

Numbers in parentheses following a type indicate the maximum length of that field. Any values longer than the maximum length will be truncated.

An arbitrary number of different Types are supported. The 'Shipping', 'Billing', or 'Primary' Types should be used when adding a shipping or billing address to a Customer.

A 'Primary' address represents both a shipping and billing address.

Where the Type of the CustomerAddress is 'Billing' then any values entered into the FirstName and LastName fields will be ignored.

Addresses with invalid country codes in their Country fields will be silently ignored and not stored.

Appendices

Response Codes

The Customers API returns standard API response codes.