Dynamic page¶
Dynamic pages is a concept which makes it possible to retrieve content from several panels at once, without predefining a zone for each combination of panels that might be called at once. A dynamic page must be called server side.
A query to a dynamic page includes arguments to the sub-panels of that page. This enables the reuse of a dynamic page by supplying different arguments to the sub-panel. A successful query returns the dynamic page content in flattened and serialised JSON format. When querying a dynamic page via the Web API, an Api-Key
header is required for authentication.
See Concepts for more information about dynamic pages.
Method¶
POST
URL format¶
/api/v2/dynamic-pages?esales.market={market}&esales.customerKey={customerKey}&esales.sessionKey={sessionKey}
Required parameters¶
Name | Type | Description | Example |
---|---|---|---|
esales.market | string | Visitor Market | Sweden |
esales.customerKey | string | Visitor id. UUID / GUID. | 5G7HJ...R77T1 |
esales.sessionKey | string | A unique id. UUID / GUID. | 2F75A...EAFA6 |
name | string | Unique name of dynamic page type. | books-and-dvds |
panel | string | Path to public panel. | /top-sellers |
Required headers¶
The header Api-Key
is required.
Other parameters¶
Additional arguments are panel dependent and may be required. See Panels for parameters for panel specific arguments.
Compression¶
Both the request and the response can be compressed with gzip
if the headers Content-Encoding
and Accept-Encoding
have the value gzip
.
Request body¶
{
"name": "string",
"arguments": {}, // Optional, key/val arguments for all sub-panels
"attributes": {}, //Optional, key/val local attributes for the dynamic page
"subpanels": [
{
"name": "string",
"panel": "string",
"arguments": {}, // Optional, key/val arguments for this sub-panel
"attributes": {} //Optional, key/val local attributes for this sub-panel
}
]
}
Request content-type¶
application/json
Response content-type¶
application/json
Responses¶
Response | Description |
---|---|
200 | Panel content flattened and serialised to JSON. |
400 | Invalid or missing arguments to any of the requested panels. |
403 | Api-Key could not be validated. |
5xx | Server error such as cluster unavailable or busy. The response body may contain more information about the error. |
Example¶
Request¶
request-body.json¶
The following example shows how a dynamic page named shirts and pants
containing two sub-panels and based on the predefined public panel /product-list
is requested.
{
"name": "shirts and pants",
"arguments": {},
"attributes": {
"panelId": "123"
},
"subpanels": [{
"name": "pants",
"panel": "/product-list",
"arguments": {
"window_first": 1,
"window_last": 10,
"filter": "category:'A'"
}
},
{
"name": "shirts",
"panel": "/product-list",
"arguments": {
"window_first": 1,
"window_last": 10,
"filter": "category:'B'"
}
}
]
}
cURL¶
#!/bin/bash
curl -i \
-X POST \
-T request-body.json \
-H "Content-Type: application/json" \
-H "Api-Key: {PRIVATE-KEY}" \
"https://{cluster-id}.api.esales.apptus.cloud/api/v2/dynamic-pages?esales.market=UK&esales.customerKey=d9528030-509c-4e0f-b585-7168f1e9feca&esales.sessionKey=b106299c-eac0-4f6f-96d2-93e57c255784"
Response¶
JSON
{
"pants": [
{
"name": "pants",
"ticket": "Oy9keW5hbWljLXBhZ2VzL3NoaXJ0cy1hbmQtcGFudHMvdG9wLXNlbGxpbmctcGFudHM7IzsjOyM7IzsjOyM7Izs",
"path": "/dynamic-pages/shirts-and-pants/pants",
"description": "Displays a list of products and is intended to be used for static searches.",
"displayName": "Product List",
"attributes": {
"panelId": "123"
},
"resultType": "products",
"products": [
{
"key": "P5",
"ticket": "Oy9keW5hbWljLXBhZ2VzL3NoaXJ0cy1hbmQtcGFudHMvdG9wLXNlbGxpbmctcGFudHM7Iztwcm9kdWN0X2tleTtQNTsjO09CSkVDVElWRSQ7Tk9ORTpOT05FOzYxOw",
"variants": [],
"attributes": {
"price": "3",
"rank": "1",
"relevance": "1.0"
},
"categoryReferenceAttributes": {
"category": [
{
"key": "A",
"parentKey": "clothes",
"displayName": "Pants",
"attributes": {}
}
]
}
}
]
}
],
"shirts": [
{
"name": "shirts",
"ticket": "Oy9keW5hbWljLXBhZ2VzL3NoaXJ0cy1hbmQtcGFudHMvdG9wLXNlbGxpbmctc2hpcnRzOyM7IzsjOyM7IzsjOyM7",
"path": "/dynamic-pages/shirts-and-pants/shirts",
"description": "Displays a list of products and is intended to be used for static searches.",
"displayName": "Product List",
"attributes": {
"panelId": "123"
},
"resultType": "products",
"products": [
{
"key": "P3",
"ticket": "Oy9keW5hbWljLXBhZ2VzL3NoaXJ0cy1hbmQtcGFudHMvdG9wLXNlbGxpbmctc2hpcnRzOyM7cHJvZHVjdF9rZXk7UDM7IztPQkpFQ1RJVkUkO05PTkU6Tk9ORTs2MTs",
"variants": [],
"attributes": {
"price": "5",
"rank": "1",
"relevance": "1.0"
},
"categoryReferenceAttributes": {
"category": [
{
"key": "B",
"parentKey": "clothes",
"displayName": "Shirts",
"attributes": {}
}
]
}
}
]
}
]
}