Customers

POST Search for customers in a customer list.

POST /organizations/{organizationId}/customer-lists/{customerListId}/customer-search

Operation ID: searchCustomerInCustomerList. Security: AmOAuth2 (sfcc.customerlists, sfcc.customerlists.rw).

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

Parameters

  • customerListId (path, string, required) The customer list ID.
    Minimum length: 1. Maximum length: 256. Example: Site1CustomerList.
  • organizationId (path, OrganizationId, required) An identifier for the Salesforce Commerce Cloud organization the request is being made by. It consists of a prefix 'f_ecom_' followed by a 4-character realm identifier and a 3-character instance type identifier.

    Example

    f_ecom_zzxy_prd

Request body (required)

Media type: application/json. Schema: SearchRequest.

Example: CustomerSearchBody

{
  "limit": 2,
  "offset": 50,
  "query": {
    "textQuery": {
      "fields": [
        "email"
      ],
      "searchPhrase": "wleung"
    }
  }
}

Responses

  • 200 Success

    Media type: application/json. Schema: CustomerSearchResult.

    Example: CustomerSearchResult

    {
      "hits": [
        {
          "data": {
            "birthday": "1999-12-31",
            "companyName": "Salesforce",
            "creationDate": "2023-07-21T07:29:39.505Z",
            "credentials": {
              "enabled": true,
              "locked": false,
              "login": "af4ab358-3187-4ec5-82a6-918e0fe8a21f"
            },
            "customerId": "absAzIVSkman3GPpSYluYBbLrB",
            "customerNo": "00000012",
            "email": "w.leung@gmail.com",
            "fax": "123-123-1234",
            "firstName": "Wei",
            "gender": 1,
            "lastModified": "2023-07-21T07:29:39.506Z",
            "lastName": "Leung",
            "phoneBusiness": "123-123-1234",
            "phoneHome": "123-123-1234",
            "phoneMobile": "123-123-1234",
            "preferredLocale": "en-US",
            "salutation": "Dr.",
            "secondName": "J",
            "suffix": "Jr.",
            "title": "Mr."
          },
          "relevance": 4.258296012878418
        }
      ],
      "limit": 1,
      "offset": 0,
      "query": {
        "textQuery": {
          "fields": [
            "email"
          ],
          "searchPhrase": "w.leung@gmail.com"
        }
      },
      "total": 1
    }
  • 400 Bad Request. Returned when a specified parameter value is unknown.

    Media type: application/problem+json. Schema: ErrorResponse.

    Example: searchCustomerInCustomerList400

    {
      "title": "Bad Request",
      "type": "https://api.commercecloud.salesforce.com/documentation/error/v1/errors/invalid-query-parameter",
      "detail": "offset-BAD-REQUEST parameters are not defined in RAML."
    }
  • 401 Unauthorized. Your Client ID is invalid, or you are not allowed to access the content provided by the requested URL.

    Media type: application/problem+json. Schema: ErrorResponse.

    Example: searchCustomerInCustomerList401

    {
      "title": "Invalid Access Token",
      "type": "https://api.commercecloud.salesforce.com/documentation/error/v1/errors/invalid-access-token",
      "detail": "The request is unauthorized, the access token is invalid.",
      "accessToken": "hbGciOiJIUzI1NiIsInR5cCI6Ikp"
    }
  • 404 Not Found. This error is thrown when the ID does not match any of the customer group sites or if the ID is ill-formed.

    Media type: application/problem+json. Schema: ErrorResponse.

    Example: searchCustomerInCustomerList404

    {
      "title": "Customer List Not Found",
      "type": "https://api.commercecloud.salesforce.com/documentation/error/v1/errors/customer-list-not-found",
      "detail": "No customer list with ID 'SiteGenesis-NOT-FOUND' could be found.",
      "listId": "SiteGenesis-NOT-FOUND"
    }