ProductSearch resource (Data API 19.1)

Summary

Http Method Resource Description
POST /product_search

Searches for products.

The query attribute specifies a complex query that can be used to narrow down the search. Attributes are grouped into different buckets. These are the list of searchable attributes with their corresponding buckets:

Main:

  • id - String
  • name - String
  • online - SiteSpecific Boolean
  • searchable - SiteSpecific Boolean
  • valid_from - SiteSpefic DateTime
  • valid_to - SiteSpecfic DateTime
  • type - ProductType
  • creation_date - DateTime

Catalog:

  • catalog_id - String

Category:

  • category_id - String

Special:

  • type - {"item", "set, "bundle", "master", "part_of_product_set", "bundled", "variant", "variation_group", "option", "retail_set", "part_of_retail_set"}

The sortable properties are:

  • id - String
  • name - String
  • creation_date - DateTime

Note that catalog_id is the id of the catalog to which products are assigned to.

Only attributes in the same bucket can be joined using a disjunction (OR). For instance, when joining id and catalog_id above, only a conjunction is allowed (AND), whereas id and searchable can be joined using a disjunction because they are in the same bucket. If an attribute is used in a disjunction (OR) that violates this rule, an exception will be thrown.

The product search retrieves additional properties of the product when expansions are used. The available expand attribute values are:

  • 'all' will retrieve all the product properties.
  • 'availability' will retrieve the following properties:
    • ats
    • in_stock
    • online
  • 'images' will retrieve the following properties:
    • image
  • 'all_images' used with images will retrieve the following properties:
    • image
    • image_groups
  • 'prices' will retrieve the following properties:
    • price
    • price_currency
  • 'sets' will retrieve the following properties:
    • set_products
    • product_sets
  • 'bundles' will retrieve the following properties:
    • product_bundles
    • bundled_products

Search Products

Searches for products.

The query attribute specifies a complex query that can be used to narrow down the search. Attributes are grouped into different buckets. These are the list of searchable attributes with their corresponding buckets:

Main:

Catalog:

Category:

Special:

The sortable properties are:

Note that catalog_id is the id of the catalog to which products are assigned to.

Only attributes in the same bucket can be joined using a disjunction (OR). For instance, when joining id and catalog_id above, only a conjunction is allowed (AND), whereas id and searchable can be joined using a disjunction because they are in the same bucket. If an attribute is used in a disjunction (OR) that violates this rule, an exception will be thrown.

The product search retrieves additional properties of the product when expansions are used. The available expand attribute values are:

Url

POST https://hostname:port/dw/data/v19_1/product_search?site_id={String}

Formats

json, xml

Authentication

Name Description
OAuth Authentication via OAuth token.

Request Document

SearchRequest

Response Document

ProductSearchResult

Query Parameters

Parameter Type Description Constraints
site_id String The site context.  

In case of a failure Fault Document is returned.

Faults

Status Type Arguments Description
400 MalformedSearchParameterException   Indicates the search query is ill-formed.

Sample

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

{
    "query" : {
        "text_query": {
            "fields": ["id"],
            "search_phrase": "my-product"
        }
    },
    "select" : "(**)"
}

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

{
  "_v" : "19.1",
  "count" : 1,
  "hits" :    [
      {
         "_type" : "product",
         "_resource_state" : "860cde3040519cce439cd99e209f8a87c3ad0b7e2813edbf6f5501f763b73bd5",
         "brand" : "Brand",
         "id" : "my-product",
         "link" : "https://example.com/s/-/dw/data/v19_1/products/my-product",
         "long_description" : 
         {
            "default" : "Long Description"
         },
         "manufacturer_name" : "master manufacturer",
         "manufacturer_sku" : "master manufacturer ID",
         "name" : 
         {
            "default" : "Master"
         },
         "online" : 
         {
            "default" : true
         },
         "owning_catalog_id" : "my-catalog",
         "owning_catalog_name" : 
         {
            "default" : "My Catalog"
         },
         "price" : 100.00,
         "price_currency" : "USD",
         "searchable" : 
         {
            "default" : true
         },
         "short_description" : 
         {
            "default" : "Short Description"
         },
         "type" : 
         {
            "_type" : "product_type",
            "bundled" : true,
            "master" : true,
            "part_of_product_set" : true
         },
         "unit" : "mst",
         "upc" : "WapiMaster UPC"
    },
    {
         "_resource_state":"g940fgk4rfmc9ddcu939dx",
         "brand" : "QA",
         "id" : "my-product2",
         "in_stock" : true,
         "link" : "https://example.com/s/-/dw/data/v19_1/products/my-product2",
         "name" : 
         {
            "default" : "Offline Categorized Variant 2"
         },
         "online" : 
         {
            "default" : true
         },
         "searchable" : 
         {
            "default" : true
         },
         "short_description" : 
         {
            "default" : "Offline and categorized variant in offline master."
         },
         "type" : 
         {
            "_type" : "product_type",
            "variant" : true
         }
      }
   ],
  "query" : { "text_query": { "fields": ["id"], "search_phrase": "my-product" } },
  "select": "**",
  "start" : 0,
  "total" : 2
}