CategorySearch resource (Data API 23.2)

Summary

Http Method Resource Description
POST /category_search

Searches for catalog categories anywhere they appear.

By default, the server also returns the first level of subcategories, but you can specify another level by setting the levels parameter. Please note, using a large value for levels may cause performance issues in case of a large and deep category tree.

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
  • name - String
  • description - String
  • creation_date - DateTime
  • online - Boolean
  • catalog_id - String

The output of the query can also be sorted. These are the list of sortable attributes:

  • id - String
  • name - String
  • description - String
  • creation_date - DateTime
  • online - Boolean
  • position - Double

Search Categories

Searches for catalog categories anywhere they appear.

By default, the server also returns the first level of subcategories, but you can specify another level by setting the levels parameter. Please note, using a large value for levels may cause performance issues in case of a large and deep category tree.

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
  • name - String
  • description - String
  • creation_date - DateTime
  • online - Boolean
  • catalog_id - String

The output of the query can also be sorted. These are the list of sortable attributes:

  • id - String
  • name - String
  • description - String
  • creation_date - DateTime
  • online - Boolean
  • position - Double

Url

POST https://hostname:port/dw/data/v23_2/category_search?levels={Integer}

Formats

json, xml

Authentication

Name Description
OAuth Authentication via OAuth token.

Request Document

SearchRequest

Response Document

CategorySearchResult

Query Parameters

Parameter Type Description Constraints
levels Integer   minIntegerValue=0

In case of a failure Fault Document is returned.

Faults

Status Type Arguments Description
400 MalformedSearchParameterException   Thrown if the query is ill-formed.

Sample

REQUEST:
POST /s/-/dw/data/v23_2/category_search HTTP/1.1
Host: example.com
Authorization: Bearer a5b6eb0d-8312-41a3-88f3-2c53c4507367
Accept: application/json

{   "query" : { 
        "term_query": { 
            "fields" : ["online"], 
            "operator" : "is",
            "values" : [false] 
        }
    },
    "select" : "(**)" 
}

RESPONSE:
HTTP/1.1 200 OK
Content-Length: 367
Content-Type: application/json; charset=UTF-8

{
  "_v" : "23.2",
  "_type": "category_search_result",
  "count" : 1,
  "hits" : [
    {
        "_type": "category",
        "_resource_state":"c2309jd239jdrifj3ui4fn",
        "catalog_id": "WapiCatalog",
        "creation_date" : "2015-12-15T18:46:09.000Z",
        "description" :
        {
            "default" : "category 1.1 description\n        "
        },
        "id" : "my-category1",
        "image" : "https://www.example.com/on/demandware.static/-/Sites-WapiCatalog/default/v1450204042887/category%201.1%20image",
        "link" : "https://www.example.com/s/-/dw/data/v23_2/catalogs/WapiCatalog/categories/my-category1",
        "name" : 
        {
            "default" : "Category 1"
        },
        "online" : false,
        "parent_category_id" : "root",
        "position" : 1.0,
        "thumbnail" : "https://www.example.com/on/demandware.static/-/Sites-WapiCatalog/default/v1450204042887/category%201.1%20thumbnail"
     }
  ],
  "query" : 
  { 
      "term_query": 
      { 
         "fields" : ["online"], 
         "operator" : "is",
         "values" : [false]
      } 
  },
  "select": "**",
  "start" : 0,
  "total" : 1
}
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.