CustomerGroupSearch resource (Data API 23.2)
Summary
| Http Method | Resource | Description | 
|---|---|---|
| POST | /sites/{site_id}/customer_group_search | 
 Searches for customer groups. The query attribute specifies a complex query that can be used to narrow down the search. These are the list of searchable attributes: 
 The output of the query can also be sorted. These are the list of sortable attributes: 
  | 
Search CustomerGroups
Searches for customer groups.
The query attribute specifies a complex query that can be used to narrow down the search. These are the list of searchable attributes:
- id - String
 - description - String
 - type - String Enum value[system, dynamic, static]
 
The output of the query can also be sorted. These are the list of sortable attributes:
- id - String
 - description - String
 
Url
POST https://hostname:port/dw/data/v23_2/sites/{site_id}/customer_group_search
Formats
json, xml
Authentication
| Name | Description | 
|---|---|
| OAuth | Authentication via OAuth token. | 
Request Document
Response Document
Path Parameters
| Parameter | Type | Description | Constraints | 
|---|---|---|---|
| site_id | String | The id of the site. | minLength=1 | 
In case of a failure Fault Document is returned.
Faults
| Status | Type | Arguments | Description | 
|---|---|---|---|
| 400 | CustomerGroupTypeInvalidException | 
 type (String)  | 
Thrown if the search term in term query does not match any of the customer group type. | 
| 400 | MalformedSearchParameterException | 
Thrown if the query is ill-formed. | 
Sample
REQUEST:
POST /s/-/dw/data/v23_2/sites/SiteGenesis/customer_group_search HTTP/1.1
Host: example.com
Authorization: Bearer a5b6eb0d-8312-41a3-88f3-2c53c4507367
Accept: application/json
{
    "query" : {
        "text_query": {
            "fields": ["id", "description"],
            "search_phrase": "test"
        }
    },
    "select" : "(**,hits.(**,member_count))"
}
RESPONSE:
HTTP/1.1 200 OK
Content-Length: 67
Content-Type: application/json; charset=UTF-8
{
  "_v" : "23.2",
   "_resource_state" : "860cde3040519cce439cd99e209f8a87c3ad0b7e2813edbf6f5501f763b73bd5",
  "count" : 2,
  "hits" : [
    {
       "_type" : "customer_group",
       "_resource_state":"c2309jd239jdrifj3ui4fn",
       "description" : "Test group",
       "id" : "test_customergroup1",
       "link" : "https://example.com/s/-/dw/data/v23_2/sites/SiteGenesis/customer_groups/test_customergroup1",
       "type" : "dynamic"
    },
    {
       "_type" : "customer_group",
       "_resource_state":"hsd23738s9x20ks302s12s",
       "description" : "Test group",
       "id" : "test_customergroup2",
       "link" : "https://example.com/s/-/dw/data/v23_2/sites/SiteGenesis/customer_groups/test_customergroup2",
       "member_count" : 5,
       "type" : "static"
    }  ],
  "query" : { "text_query": { "fields": ["id", "description"], "search_phrase": "test" } },
  "select": "(**,hits.(**,member_count))",
  "start" : 0,
  "total" : 2
}
X
OCAPI versions 15.x and 16.x will be retired on March 31, 2021. For dates and more information, see the OCAPI versioning and deprecation policy and this Knowledge Article.