SortingRuleSearch resource (Data API 23.2)

Summary

Http Method Resource Description
POST /sites/{site_id}/sorting_rule_search

Searches for product sorting rules.

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
  • creation_date - date of creation

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

  • id - String
  • description - String
  • creation_date - date of creation

This resource does not support expand options.

Search Product Sorting Rules

Searches for product sorting rules.

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
  • creation_date - date of creation

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

  • id - String
  • description - String
  • creation_date - date of creation

This resource does not support expand options.

Url

POST https://hostname:port/dw/data/v23_2/sites/{site_id}/sorting_rule_search?rule_context={String}

Formats

json, xml

Authentication

Name Description
OAuth Authentication via OAuth token.

Request Document

SearchRequest

Response Document

SortingRuleSearchResult

Path Parameters

Parameter Type Description Constraints
site_id String The id of the site. minLength=1

Query Parameters

Parameter Type Description Constraints
rule_context String the optional context in which the sorting rule should be looked up, either "site", "global", or "any" (default) strings=["global", "site", "any"]

Sample

REQUEST:
POST /s/-/dw/data/v23_2/sites/SiteGenesis/sorting_rule_search?context=site HTTP/1.1
Host: example.com
Authorization: Bearer a5b6eb0d-8312-41a3-88f3-2c53c4507367
Accept: application/json

{
    "query" : {
        "text_query": {
            "fields": ["id", "description"],
            "search_phrase": "price"
        }
    },
    "select" : "(**)"
}

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

{
   "_v" : "23.2",
   "_type" : "product_sorting_rule_search_result",
   "count" : 2,
   "hits" : 
   [
      
      {
         "_type" : "product_sorting_rule",
         "description" : "Sorts by price descending",
         "id" : "price-high-to-low",
         "context" : "site",
         "product_sorting_rule_steps" : 
         [
            
            {
               "_type" : "product_sorting_rule_step",
               "direction" : "Descending",
               "is_system" : false,
               "position" : 0,
               "text_relevance_included" : false,
               "type_id" : "price"
            }
         ],
         "site" : "SiteGenesis"
      },
      
      {
         "_type" : "product_sorting_rule",
         "description" : "Sorts by price ascending",
         "id" : "price-low-to-high",
         "context" : "site",
         "product_sorting_rule_steps" :
         [
            
            {
               "_type" : "product_sorting_rule_step",
               "direction" : "Ascending",
               "is_system" : false,
               "position" : 0,
               "text_relevance_included" : false,
               "type_id" : "price"
            }
         ],
         "site" : "SiteGenesis"
      }
   ],
   "query" : 
   {
      "text_query" : 
      {
         "_type" : "text_query",
         "fields" : 
         [
            "id",
            "description"
         ],
         "search_phrase" : "price"
      }
   },
   "select" : "(**)",
   "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.
Notifications pending to read 9