Products Resource (Data API 16.8)

Summary

Http Method Resource Description
GET /Products/{Id} Action to get product information.
DELETE /Products/{Id} Deletes the product by ID
PUT /Products/{Id} Creates a product using the information provided. If a product with the same unique identifier, it will be cleaned and overwritten unless the header x-dw-validate-existing=true is passed in with the request.
PATCH /Products/{Id} Update a product using the information provided. Fields that can be updated: name, page_description, long_descripton, page_title, page_keywords, brand, ean,upc, manufacture_sku, manufacture_name, searchable, unit, searchable, online_flag, default_variant_id.

Get Product

Action to get product information.

Url

GET https://hostname:port/dw/data/v16_8/products/{id}?site_id={String}&expand={String}

Formats

json, xml

Response Document

Product

Path Parameters

Parameter Type Description Constraints
id String The product ID. minLength=1

Query Parameters

Parameter Type Description Constraints
expand String

The list of expansions that can be applied to the product. They 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
  • 'prices' will retrieve the following properties:
    • price
    • price_currency
  • 'variations' will retrieve the following properties:
    • master
    • variation_attributes
    • variation_groups
    • variation_values
    • variants

Note that only variants with variation values are retrieved for a product of type variation master.

 
site_id String The site context.  

In case of a failure Fault Document is returned.

Faults

Status Type Arguments Description
404 ProductNotFoundException

productId (String)

Indicates the product is not found.

Sample

REQUEST:
GET  /s/-/dw/data/v16.8/products/my-product?expand=availability&site_id=SiteGenesis HTTP/1.1
Host: example.com
Authorization: Bearer a5b6eb0d-8312-41a3-88f3-2c53c4507367
Content-Type: application/json; charset=UTF-8

# in case of success:
 
RESPONSE:
HTTP/1.1 200 OK
Expires: Thu, 01-Aug-2014 00:00:00 GMT
{
    "_v" : "16.8",
   "_resource_state" : "860cde3040519cce439cd99e209f8a87c3ad0b7e2813edbf6f5501f763b73bd5",
   "_type" : "product",
   "ats" : 500,
   "brand" : "Brand",
   "ean" : "EAN",
   "id" : "my-product",
   "in_stock" : true,
   "link" : "https://example.com/s/-/dw/data/v16.8/products/my-product",
   "long_description" : 
   {
      "default" : "Long Description"
   },
   "manufacturer_name" : "Manufacturer",
   "manufacturer_sku" : "Manufacturer ID",
   "name" : 
   {
      "default" : "My Product"
   },
   "online" : true,
   "online_flag" : 
   {
      "default" : true
   },
   "owning_catalog_id" : "my-catalog",
   "owning_catalog_name" : 
   {
      "default" : "My Catalog"
   },
   "page_description" : 
   {
      "default" : "Page description"
   },
   "page_keywords" : 
   {
      "default" : "Page Keyword"
   },
   "page_title" : 
   {
      "default" : "Page title"
   },
   "searchable" : 
   {
      "default" : true
   },
   "short_description" : 
   {
      "default" : "Short Description"
   },
   "type" : 
   {
      "_type" : "product_type",
      "bundle" : true,
      "bundled" : true,
      "part_of_product_set" : true
   },
   "unit" : "bnd",
   "upc" : "UPC"
}

# in case of failure:
 
RESPONSE:
HTTP/1.1 404 Not Found
Expires: Thu, 01-Jan-1970 00:00:00 GMT
Content-Type: application/json;charset=UTF-8
Cache-Control: max-age=0,no-cache,no-store,must-revalidate
{
  "_v":"16.8",
  "fault":{
    "type":"ProductNotFoundException",
    "message":"No product with id 'my-product' found."
  }
}

Delete Product

Deletes the product by ID

Url

DELETE https://hostname:port/dw/data/v16_8/products/{id}

Formats

json, xml

Path Parameters

Parameter Type Description Constraints
id String The product ID. maxLength=100, minLength=1

In case of a failure Fault Document is returned.

Faults

Status Type Arguments Description
404 ProductNotFoundException

productId (String)

Indicates the product is not found.

Sample

REQUEST:
DELETE /s/-/dw/data/v16_8/products/product1 HTTP/1.1
Host: example.com
Authorization: Bearer a5b6eb0d-8312-41a3-88f3-2c53c4507367
x-dw-resource-state: 860cde3040519cce439cd99e209f8a87c3ad0b7e2813edbf6f5501f763b73bd5

# in case of success:

RESPONSE:
HTTP/1.1 204 No Content

# in case of failure:

RESPONSE:
HTTP/1.1 404 Not Found
Expires: Thu, 01-Jan-1970 00:00:00 GMT
Content-Type: application/json;charset=UTF-8
Cache-Control: max-age=0,no-cache,no-store,must-revalidate
{
  "_v":"16.8",
  "fault":{
    "type":"ProductNotFoundException",
    "message":"No product with id 'my-product' found."
  }
}

Create Product

Creates a product using the information provided. If a product with the same unique identifier, it will be cleaned and overwritten unless the header x-dw-validate-existing=true is passed in with the request.

Url

PUT https://hostname:port/dw/data/v16_8/products/{id}

Formats

json, xml

Request Document

Product

Response Document

Product

Path Parameters

Parameter Type Description Constraints
id String The product ID. maxLength=100, minLength=1

In case of a failure Fault Document is returned.

Faults

Status Type Arguments Description
400 ProductInvalidException

productId (String)

field (String)

detail (String)

Indicates the catalog is not provided in the request.
400 IdConflictException

bodyID (String)

urlID (String)

Indicates the ID in request URL does not match the ID in the product document.
404 CatalogNotFoundException

catalogId (String)

Indicates the catalog is not found.

Sample

REQUEST:
PUT /s/-/dw/data/v16_8/products/product1 HTTP/1.1
Host: example.com
Authorization: Bearer a5b6eb0d-8312-41a3-88f3-2c53c4507367
{
    "owning_catalog_id" : "WapiCatalog", 
    "id" : "product1"
}

# in case of success:

RESPONSE:
HTTP/1.1 201 CREATED
Content-Length: 67
Content-Type: application/json; charset=UTF-8
{
    "_v" : "16.8",
    "_resource_state" : "860cde3040519cce439cd99e209f8a87c3ad0b7e2813edbf6f5501f763b73bd5",
    "_type": "product",
    "id" : "product1",
    "link": "https://example.com/s/-/dw/data/v16_8/products/product1",
    "online": false,
    "owning_catalog_id" : "WapiCatalog",
    "searchable": false
}

# in case of failure:

RESPONSE:
HTTP/1.1 404 Not Found
Content-Type: application/json;charset=UTF-8
Cache-Control: max-age=0,no-cache,no-attribute,must-revalidate
{
    "_v":"16.8",
    "fault":{
        "type":"CatalogNotFoundException",
        "message":"No catalog with id 'my-catalog' found."
    }
}

Update Product

Update a product using the information provided. Fields that can be updated: name, page_description, long_descripton, page_title, page_keywords, brand, ean,upc, manufacture_sku, manufacture_name, searchable, unit, searchable, online_flag, default_variant_id.

Url

PATCH https://hostname:port/dw/data/v16_8/products/{id}

Formats

json, xml

Request Document

Product

Response Document

Product

Path Parameters

Parameter Type Description Constraints
id String The product ID. maxLength=100, minLength=1

In case of a failure Fault Document is returned.

Faults

Status Type Arguments Description
400 ProductDefaultVariantException

masterId (String)

variantId (String)

Indicates there is a problem to set default variant for a product.
400 IdConflictException

bodyID (String)

urlID (String)

Indicates the ID in request URL does not match the ID in the product document.
404 ProductNotFoundException

productId (String)

Indicates the product to be updated is not found.

Sample

REQUEST:
PATCH /s/-/dw/data/v16_8/products/product1 HTTP/1.1
Host: example.com
Authorization: Bearer a5b6eb0d-8312-41a3-88f3-2c53c4507367
{
	"id" : "product1",
        "name" : 
        {
               "default" : "Product 1",
               "zh-CN" : "产品 1"
        }
}

# in case of success:

RESPONSE:
HTTP/1.1 201 CREATED
Content-Length: 67
Content-Type: application/json; charset=UTF-8
x-dw-resource-state: 860cde3040519cce439cd99e209f8a87c3ad0b7e2813edbf6f5501f763b73bd5
{
   "_v" : "16.8",
   "_type" : "product",
   "_resource_state" : "cb8ba8f6173b517d36f8ccaa705a8072ed3369919b79c10c5b6afbfa4e1673ce",
   "id" : "product1”,
   "link" : "https://example.com/s/-/dw/data/v16_8/products/product1",
   "name" : 
        {
               "default" : "Product 1",
               "zh-CN" : "产品 1"
        }
   "online_flag" : 
   {
      "default" : false
   },
   "owning_catalog_id" : “testCatalog",
   "owning_catalog_name" : 
   {
      "default" : “Test Catalog"
   },
   "searchable" : 
   {
      "default" : false
   },
   "type" : 
   {
      "_type" : "product_type",
      "item" : true
   }
}

# in case of failure:

RESPONSE:
HTTP/1.1 404 Not Found
Content-Type: application/json;charset=UTF-8
Cache-Control: max-age=0,no-cache,no-attribute,must-revalidate
{
    "_v":"16.8",
    "fault":{
        "type”:”ProductNotFoundException",
        "message":"No product with id ‘product1’ found."
    }
}