younifyd
Menu

Search Customer In Customer List

Search for customers in a customer list.

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

Use it in a workflow

  1. Add a step and choose the Salesforce Commerce Cloud connector.
  2. Pick the Search Customer In Customer List action (under Customers (Data API)).
  3. Fill in the fields below, then reference the result from later steps as {{searchCustomerInCustomerList.response.data}}.

Request

Path parameters

customerListIdstringrequired

The customer list ID.

organizationIdstringrequired

An identifier for the organization the request is being made by

Request body

Enter the body as JSON in the step's Body field.

limitinteger (int32)

Maximum records to retrieve per request, not to exceed 200.

queryobjectrequired

A set of objects that define criteria used to select records. A query can contain one of the following: * `MatchAllQuery` - Matches all documents. * `TermQuery` - Matches one or more documents against one or more document fields. * `TextQuery` - Matches text against one or more fields. * `BoolQuery` - Allows construction of a logical expression of multiple queries. * `FilteredQuery` - Allows a filter to be applied to a query. * `NestedQuery` - Allows you to query on nested documents. - _Only supported by some Commerce APIs. For more details, see the endpoint descriptions in the API documentation._

boolQueryobject3 fields

A boolean query allows construction of full logical expression trees that are composed of other queries (usually term queries and text queries). A boolean query has three sets of clauses: - `must`, which combines as an `AND` operator. - `should`, which combines as an `OR` operator. - `must_not`, which combines as a `NOT` operator. If `must`, `mustNot`, or `should` appear in the same boolean query, they are combined logically using the `AND` operator. For example: (must-1 AND must-1 AND ...) AND (should-1 OR should-2 OR ...) AND NOT (must_not-1 OR must_not-2 OR ...)

filteredQueryobject2 fields

Allows to filter the result of a possibly complex query using a possibly complex filter.

matchAllQueryobject

Matches all documents (namespace and document type). This query comes in handy if you just want to filter a search result or really do not have any constraints.

nestedQueryobject3 fields

Allows you to query nested documents that are part of a larger document. Say, for example, that you have a main product with variations in one big document, and you want to constrain a search to main products that have variations that match multiple constraints. A `NestedQuery` is only supported by some Commerce APIs. For more details, see the endpoint descriptions in the API documentation.

termQueryobject3 fields

A term query matches one or more values against one or more document fields. A document is considered a hit if one of the values matches exactly with at least one of the given fields. The operator `is` can only take one value, while `one_of` can take multiple values. If multiple fields are specified, they are combined using a logical `OR` operator. **Limitations:** * The `greater` and `less` operators are not supported under certain conditions. Both operators are permitted unless the API documentation states otherwise. * A subset of Commerce APIs handle queries with multiple fields differently. If the query has multiple fields, the query is internally handled as a logical `OR` of `DisjointMaxQueries` (with the dismax matching a value against all fields). The dismax makes sure that a document carrying a single term in multiple fields does not get higher scores than a document matching multiple terms in multiple fields.

textQueryobject2 fields

A text query is used to match some text (for example, a search phrase possibly consisting of multiple terms) against one or more fields. When multiple fields are provided, the phrase conceptually forms a logical `OR` over the fields. In this case, the terms of the phrase basically have to match within the text, that would result in concatenating all given fields.

sortsarray<object>

The list of sort clauses configured for the search request. Sort clauses are optional. See the description of the search endpoint for details on the default sorting behavior that is used when explicit sorts are not passed.

fieldanyrequired

The name of the field to sort on.

sortOrderstring

The sort order to be applied when sorting. When omitted, the default sort order (asc) is used.

One ofascdescDefault "asc"

offsetinteger (int32)

The zero-based index of the first hit/data to include in the result.

Default 0

json
{
  "query": {
    "filteredQuery": {
      "query": {
        "textQuery": {
          "fields": [
            "couponId"
          ],
          "searchPhrase": "disabled"
        }
      },
      "filter": {
        "termFilter": {
          "field": "enabled",
          "operator": "is",
          "values": [
            false
          ]
        }
      }
    }
  },
  "limit": 10,
  "sorts": [
    {
      "field": "couponId",
      "sortOrder": "desc"
    }
  ],
  "offset": 0
}

Response

Returns 200 with an object. Read it in later steps with {{searchCustomerInCustomerList.response.data.<field>}}.

hitsarray<object>

The sorted array of search hits. Can be empty.

dataanyrequired

List of found customers.

relevancenumber (double)required

The hit's relevance score.

json
{
  "hits": [
    {
      "customerNo": "D100201",
      "lastName": "Leung"
    }
  ]
}

Need more? See the Salesforce Commerce Cloud guide for connection setup and behaviour shared by every action.