Content Resource (Shop API 16.4)

Summary

Http Method Resource Description
GET /Content/({Id},...,{Id}) To access multiple content asset, you construct a URL using the template shown below. This template requires you to specify one or many content asset id. In response, the server returns a result set of corresponding content asset documents. Only content assets, which are marked as online are returned. An assignment to a folder is not necessary.
GET /Content/{Id} To access a content asset, you construct a URL using the template shown below. This template requires you to specify a content asset id. In response, the server returns a corresponding content asset document. Only content assets, which are marked as online are returned. An assignment to a folder is not necessary.

Get Multiple Content

To access multiple content asset, you construct a URL using the template shown below. This template requires you to specify one or many content asset id. In response, the server returns a result set of corresponding content asset documents. Only content assets, which are marked as online are returned. An assignment to a folder is not necessary.

Url

GET http://hostname:port/dw/shop/v16_4/content/({id},...,{id})?locale={String}

Formats

json, xml

Authentication

Name Description
None No authentication.

Response Document

ContentResult

Path Parameters

Parameter Type Description Constraints
ids [String] The ids of the requested content assets maxItems=50, maxLength=256

Query Parameters

Parameter Type Description Constraints
locale String The locale context  

Customization

This Resource supports server-side customization.

Extension Point Method Detail
dw.ocapi.shop.content.afterGET

afterGET (doc : Document) : Status

The function is called after the request has been processed.

Parameters:
doc - the document
Returns:
  • Status.OK for success.
  • Status.ERROR in case something went wrong.

Sample

REQUEST:
GET /dw/shop/v16_4/content/(about-us,terms) HTTP/1.1
Host: example.com
Accept: application/json

RESPONSE:
HTTP/1.1 200 OK
Content-Type: application/json;charset=UTF-8
Cache-Control: max-age=900,must-revalidate
Content-Length: 13120
{
  "_v":"16.4",
  "_type":"content_result",
  "count":2,
  "total":2,
  "data":
  [
    {
      "description" : "It all started with a series of observations ...",
      "id" : "about-us",
      "name" : "About Us",
      "c_body" : "<h1>About Us</h1><h2>It all started with a series of observations ...",
      "c_customCSSFile" : "http://example.com/on/demandware.static/Sites-SiteGenesis-Site/Sites-SiteGenesis-Library/default/v1365077029384/css/aboutus.css"
    },
    {
      "description" : "These terms of use set forth the basis on which you are permitted to access and use this website, example.com",
      "id" : "terms",
      "name" : "Terms & Conditions of Sale",
      "c_body" : "<h1>Terms & Conditions of Sale</h1><p>ATTENTION: These terms of use set forth the basis on which you are permitted ..."
    }
  ]
}

Get Content

To access a content asset, you construct a URL using the template shown below. This template requires you to specify a content asset id. In response, the server returns a corresponding content asset document. Only content assets, which are marked as online are returned. An assignment to a folder is not necessary.

Url

GET http://hostname:port/dw/shop/v16_4/content/{id}?locale={String}

Formats

json, xml

Authentication

Name Description
None No authentication.

Response Document

Content

Path Parameters

Parameter Type Description Constraints
id String The id of the requested content asset. maxLength=256

Query Parameters

Parameter Type Description Constraints
locale String The locale context.  

Customization

This Resource supports server-side customization.

Extension Point Method Detail
dw.ocapi.shop.content.afterGET

afterGET (doc : Document) : Status

The function is called after the request has been processed.

Parameters:
doc - the document
Returns:
  • Status.OK for success.
  • Status.ERROR in case something went wrong.

Sample

REQUEST:
GET /dw/shop/v16_4/content/about-us HTTP/1.1
Host: example.com
Accept: application/json

RESPONSE:
HTTP/1.1 200 OK
Content-Type: application/json;charset=UTF-8
Cache-Control: max-age=900,must-revalidate
Content-Length: 2883

{
  "_v" : "16.4",
  "_type":"content",
  "description" : "It all started with a series of observations...",
  "id" : "about-us",
  "name" : "About Us",
  "c_body" : "<h1>About Us</h1><h2>It all started with a series of observations ...",
  "c_customCSSFile" : "http://example.com/on/demandware.static/Sites-SiteGenesis-Site/Sites-SiteGenesis-Library/default/v1365077029384/css/aboutus.css"
}