Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Customers

*# API Overview

The Customers API enables you to search for and manage customer information within a customer list. It also enables you to search for customer groups.

Once you find the customer, you can also use the API to manage customer addresses.

The customerNo is created when you create a shopper record. You can create a shopper record using the Customers API or Business Manager. For details, see registerCustomer and Create and Manage Customer Records.

b2c-commerce-customers-screenshot-1.png*

For instructions on how to retrieve access token for admin APIs: https://developer.salesforce.com/docs/commerce/commerce-api/guide/authorization-for-admin-apis.html

Example with admin auth

import { Customers, ClientConfig } from "commerce-sdk";
// or
const { Customers, ClientConfig } = require("commerce-sdk");

const clientConfig: ClientConfig = {
  parameters: {
    clientId: "XXXXXX",
    organizationId: "XXXX",
    shortCode: "XXX",
    siteId: "XX"
  }
};

token = { access_token: 'INSERT_ACCESS_TOKEN_HERE' };

clientConfig.headers['authorization'] = `Bearer ${token.access_token}`;
const customersClient = new Customers(clientConfig);
API Version: 1.4.4
Last Updated:

Hierarchy

  • BaseClient
    • Customers

Index

Constructors

constructor

  • new Customers(config: ClientConfig): Customers
  • Parameters

    • config: ClientConfig

    Returns Customers

Properties

clientConfig

clientConfig: ClientConfig

Methods

createAddressForCustomerInCustomerList

  • Creates a new customer address with the given address information.

    If you would like to get a raw Response object use the other createAddressForCustomerInCustomerList function.

    Parameters

    Returns Promise<CustomerAddress>

    A promise of type CustomerAddress.

  • Creates a new customer address with the given address information.

    Type parameters

    • T: boolean

    Parameters

    Returns Promise<T extends true ? Response : CustomerAddress>

    A promise of type Response if rawResponse is true, a promise of type CustomerAddress otherwise.

createCustomerInCustomerList

  • Create a new customer. The customer is created using the specified customer number, credentials, and customer information. This action verifies:

    • Login acceptance criteria and uniqueness.
    • Mandatory customer properties.

    If the action fails to create the customer, it returns a 400 fault with an appropriate message.

    If you would like to get a raw Response object use the other createCustomerInCustomerList function.

    Parameters

    Returns Promise<Customer>

    A promise of type Customer.

  • Create a new customer. The customer is created using the specified customer number, credentials, and customer information. This action verifies:

    • Login acceptance criteria and uniqueness.
    • Mandatory customer properties.

    If the action fails to create the customer, it returns a 400 fault with an appropriate message.

    Type parameters

    • T: boolean

    Parameters

    • options: RequireParametersUnlessAllAreOptional<{ body: Customer; fetchOptions?: RequestInit; headers?: {}; parameters?: CompositeParameters<{ customerListId: string; customerNo: string; organizationId: string } & QueryParameters, CommonParameters>; retrySettings?: OperationOptions }>

      An object containing the options for this method.

    • Optional rawResponse: T

      Set to true to return entire Response object instead of DTO.

    Returns Promise<T extends true ? Response : Customer>

    A promise of type Response if rawResponse is true, a promise of type Customer otherwise.

createCustomerList

  • Create a new customer. The customer is created using the specified credentials and customer information. This action verifies:

    • Login acceptance criteria and uniqueness.
    • Mandatory customer properties.

    If the action fails to create the customer, it returns a 400 fault with an appropriate message.

    If you would like to get a raw Response object use the other createCustomerList function.

    Parameters

    Returns Promise<Customer>

    A promise of type Customer.

  • Create a new customer. The customer is created using the specified credentials and customer information. This action verifies:

    • Login acceptance criteria and uniqueness.
    • Mandatory customer properties.

    If the action fails to create the customer, it returns a 400 fault with an appropriate message.

    Type parameters

    • T: boolean

    Parameters

    • options: RequireParametersUnlessAllAreOptional<{ body: Customer; fetchOptions?: RequestInit; headers?: {}; parameters?: CompositeParameters<{ customerListId: string; organizationId: string } & QueryParameters, CommonParameters>; retrySettings?: OperationOptions }>

      An object containing the options for this method.

    • Optional rawResponse: T

      Set to true to return entire Response object instead of DTO.

    Returns Promise<T extends true ? Response : Customer>

    A promise of type Response if rawResponse is true, a promise of type Customer otherwise.

deleteCustomerFromCustomerList

  • Deletes the customer, including all related information like the customer addresses.

    If you would like to get a raw Response object use the other deleteCustomerFromCustomerList function.

    Parameters

    Returns Promise<void>

    A promise of type void.

  • Deletes the customer, including all related information like the customer addresses.

    Type parameters

    • T: boolean

    Parameters

    • Optional options: RequireParametersUnlessAllAreOptional<{ fetchOptions?: RequestInit; headers?: {}; parameters?: CompositeParameters<{ customerListId: string; customerNo: string; organizationId: string } & QueryParameters, CommonParameters>; retrySettings?: OperationOptions }>

      An object containing the options for this method.

    • Optional rawResponse: T

      Set to true to return entire Response object instead of DTO.

    Returns Promise<T extends true ? Response : void>

    A promise of type Response if rawResponse is true, a promise of type void otherwise.

getAddressForCustomerFromCustomerList

  • Action that returns a single customer address from a customer list.

    If you would like to get a raw Response object use the other getAddressForCustomerFromCustomerList function.

    Parameters

    Returns Promise<CustomerAddress>

    A promise of type CustomerAddress.

  • Action that returns a single customer address from a customer list.

    Type parameters

    • T: boolean

    Parameters

    • Optional options: RequireParametersUnlessAllAreOptional<{ fetchOptions?: RequestInit; headers?: {}; parameters?: CompositeParameters<{ addressId: string; customerListId: string; customerNo: string; organizationId: string } & QueryParameters, CommonParameters>; retrySettings?: OperationOptions }>

      An object containing the options for this method.

    • Optional rawResponse: T

      Set to true to return entire Response object instead of DTO.

    Returns Promise<T extends true ? Response : CustomerAddress>

    A promise of type Response if rawResponse is true, a promise of type CustomerAddress otherwise.

getAddressesForCustomerFromCustomerList

  • Returns a list of all customer addresses in pages. The default page size is 10 customer addresses.

    If you would like to get a raw Response object use the other getAddressesForCustomerFromCustomerList function.

    Parameters

    • Optional options: RequireParametersUnlessAllAreOptional<{ fetchOptions?: RequestInit; headers?: {}; parameters?: CompositeParameters<{ customerListId: string; customerNo: string; limit?: number; offset?: number; organizationId: string } & QueryParameters, CommonParameters>; retrySettings?: OperationOptions }>

      An object containing the options for this method.

    Returns Promise<CustomerAddressResult>

    A promise of type CustomerAddressResult.

  • Returns a list of all customer addresses in pages. The default page size is 10 customer addresses.

    Type parameters

    • T: boolean

    Parameters

    • Optional options: RequireParametersUnlessAllAreOptional<{ fetchOptions?: RequestInit; headers?: {}; parameters?: CompositeParameters<{ customerListId: string; customerNo: string; limit?: number; offset?: number; organizationId: string } & QueryParameters, CommonParameters>; retrySettings?: OperationOptions }>

      An object containing the options for this method.

    • Optional rawResponse: T

      Set to true to return entire Response object instead of DTO.

    Returns Promise<T extends true ? Response : CustomerAddressResult>

    A promise of type Response if rawResponse is true, a promise of type CustomerAddressResult otherwise.

getCustomerFromCustomerList

  • Action to get customer information.

    If you would like to get a raw Response object use the other getCustomerFromCustomerList function.

    Parameters

    Returns Promise<Customer>

    A promise of type Customer.

  • Action to get customer information.

    Type parameters

    • T: boolean

    Parameters

    • Optional options: RequireParametersUnlessAllAreOptional<{ fetchOptions?: RequestInit; headers?: {}; parameters?: CompositeParameters<{ customerListId: string; customerNo: string; organizationId: string } & QueryParameters, CommonParameters>; retrySettings?: OperationOptions }>

      An object containing the options for this method.

    • Optional rawResponse: T

      Set to true to return entire Response object instead of DTO.

    Returns Promise<T extends true ? Response : Customer>

    A promise of type Response if rawResponse is true, a promise of type Customer otherwise.

removeAddressForCustomerInCustomerList

  • removeAddressForCustomerInCustomerList(options?: RequireParametersUnlessAllAreOptional<{ fetchOptions?: RequestInit; headers?: {}; parameters?: CompositeParameters<{ addressId: string; customerListId: string; customerNo: string; organizationId: string } & QueryParameters, CommonParameters>; retrySettings?: OperationOptions }>): Promise<void>
  • removeAddressForCustomerInCustomerList<T>(options?: RequireParametersUnlessAllAreOptional<{ fetchOptions?: RequestInit; headers?: {}; parameters?: CompositeParameters<{ addressId: string; customerListId: string; customerNo: string; organizationId: string } & QueryParameters, CommonParameters>; retrySettings?: OperationOptions }>, rawResponse?: T): Promise<T extends true ? Response : void>
  • Deletes a customer address.

    If you would like to get a raw Response object use the other removeAddressForCustomerInCustomerList function.

    Parameters

    Returns Promise<void>

    A promise of type void.

  • Deletes a customer address.

    Type parameters

    • T: boolean

    Parameters

    • Optional options: RequireParametersUnlessAllAreOptional<{ fetchOptions?: RequestInit; headers?: {}; parameters?: CompositeParameters<{ addressId: string; customerListId: string; customerNo: string; organizationId: string } & QueryParameters, CommonParameters>; retrySettings?: OperationOptions }>

      An object containing the options for this method.

    • Optional rawResponse: T

      Set to true to return entire Response object instead of DTO.

    Returns Promise<T extends true ? Response : void>

    A promise of type Response if rawResponse is true, a promise of type void otherwise.

searchCustomerGroup

  • Search for customer groups in a given site ID. The query attribute specifies a complex query that can be used to narrow down the search. The following list provides searchable attributes:

    Attribute Type
    id String
    description String
    type String

    Note: This endpoint is available with B2C Commerce version 24.2.

    If you would like to get a raw Response object use the other searchCustomerGroup function.

    Parameters

    Returns Promise<CustomerGroupSearchResult>

    A promise of type CustomerGroupSearchResult.

  • Search for customer groups in a given site ID. The query attribute specifies a complex query that can be used to narrow down the search. The following list provides searchable attributes:

    Attribute Type
    id String
    description String
    type String

    Note: This endpoint is available with B2C Commerce version 24.2.

    Type parameters

    • T: boolean

    Parameters

    Returns Promise<T extends true ? Response : CustomerGroupSearchResult>

    A promise of type Response if rawResponse is true, a promise of type CustomerGroupSearchResult otherwise.

searchCustomerInCustomerList

  • Search for customers in a customer list. The query attribute specifies a complex query that can be used to narrow down the search. The following list provides searchable attributes:

    Attribute Type
    customerNo String
    firstName String
    secondName String
    lastName String
    suffix String
    salutation String
    title String
    fax String
    phoneHome String
    phoneBusiness String
    phoneMobile String
    email String
    gender Integer
    companyName String
    credentials.login String
    credentials.enabled Boolean

    If you would like to get a raw Response object use the other searchCustomerInCustomerList function.

    Parameters

    Returns Promise<CustomerSearchResult>

    A promise of type CustomerSearchResult.

  • Search for customers in a customer list. The query attribute specifies a complex query that can be used to narrow down the search. The following list provides searchable attributes:

    Attribute Type
    customerNo String
    firstName String
    secondName String
    lastName String
    suffix String
    salutation String
    title String
    fax String
    phoneHome String
    phoneBusiness String
    phoneMobile String
    email String
    gender Integer
    companyName String
    credentials.login String
    credentials.enabled Boolean

    Type parameters

    • T: boolean

    Parameters

    Returns Promise<T extends true ? Response : CustomerSearchResult>

    A promise of type Response if rawResponse is true, a promise of type CustomerSearchResult otherwise.

updateAddressForCustomerInCustomerList

  • Updates an address of a customer with the given address information.

    If you would like to get a raw Response object use the other updateAddressForCustomerInCustomerList function.

    Parameters

    Returns Promise<CustomerAddress>

    A promise of type CustomerAddress.

  • Updates an address of a customer with the given address information.

    Type parameters

    • T: boolean

    Parameters

    • options: RequireParametersUnlessAllAreOptional<{ body: CustomerAddress; fetchOptions?: RequestInit; headers?: {}; parameters?: CompositeParameters<{ addressId: string; customerListId: string; customerNo: string; organizationId: string } & QueryParameters, CommonParameters>; retrySettings?: OperationOptions }>

      An object containing the options for this method.

    • Optional rawResponse: T

      Set to true to return entire Response object instead of DTO.

    Returns Promise<T extends true ? Response : CustomerAddress>

    A promise of type Response if rawResponse is true, a promise of type CustomerAddress otherwise.

updateCustomerInCustomerList

  • Updates the customer with the specified information. The customer number can be updated, but results in a CustomerNumberAlreadyInUseException if there is another customer with the same customer number.

    If you would like to get a raw Response object use the other updateCustomerInCustomerList function.

    Parameters

    Returns Promise<Customer>

    A promise of type Customer.

  • Updates the customer with the specified information. The customer number can be updated, but results in a CustomerNumberAlreadyInUseException if there is another customer with the same customer number.

    Type parameters

    • T: boolean

    Parameters

    • options: RequireParametersUnlessAllAreOptional<{ body: Customer; fetchOptions?: RequestInit; headers?: {}; parameters?: CompositeParameters<{ customerListId: string; customerNo: string; organizationId: string } & QueryParameters, CommonParameters>; retrySettings?: OperationOptions }>

      An object containing the options for this method.

    • Optional rawResponse: T

      Set to true to return entire Response object instead of DTO.

    Returns Promise<T extends true ? Response : Customer>

    A promise of type Response if rawResponse is true, a promise of type Customer otherwise.

Generated using TypeDoc