Content resource (Shop API 23.2)
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/v23_2/content/({id},...,{id})?locale={String}
Formats
json, xml
Authentication
Name | Description |
---|---|
JWT | Authentication via Customer JWT. |
None | No authentication. |
Response Document
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.beforeGET |
beforeGET (contentId : String ) : Status The function is called before the request will be processed.
|
dw.ocapi.shop.content.modifyGETResponse |
modifyGETResponse (scriptContent : Content , doc : Content ) : Status The function is called after the request has been processed.
|
Sample
REQUEST:
GET /dw/shop/v23_2/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" : "23.2",
"_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/v23_2/content/{id}?locale={String}
Formats
json, xml
Authentication
Name | Description |
---|---|
JWT | Authentication via Customer JWT. |
None | No authentication. |
Response Document
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.beforeGET |
beforeGET (contentId : String ) : Status The function is called before the request will be processed.
|
dw.ocapi.shop.content.modifyGETResponse |
modifyGETResponse (scriptContent : Content , doc : Content ) : Status The function is called after the request has been processed.
|
Sample
REQUEST:
GET /dw/shop/v23_2/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" : "23.2",
"_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"
}