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 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.
See Concepts and JavaScript library for more information about dynamic pages.
Method¶
POST
URL format¶
/api/v1/dynamic-pages/{name}?nameToken={nameToken}&market={market}&customerKey={customerKey}&sessionKey={sessionKey}&token={token}&arg.window_first=1&arg.window_last=10
Required Parameters¶
Name | Type | Description | Example |
---|---|---|---|
market | string | Visitor Market | Sweden |
customerKey | string | Visitor id. SHA256 hash if the visitor is signed in, otherwise a UUID / GUID. | 5G7HJ...R77T1 |
sessionKey | string | A unique id. UUID / GUID. | 2F75A...EAFA6 |
name | string | Unique name of dynamic page type. | books-and-dvds |
nameToken | string | Unique token of the used dynamic page. | Rpb24...vZXhh |
panel | string | Path to public panel. | /top-sellers |
token | string | Unique token generated by the CustomerKeyAuthentication class. Should only be set for signed in visitors. | EAFA6...2F75A |
Other Parameters¶
Additional arguments are panel dependent and may be required. All arguments must be prepended with arg.
. 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¶
[
{
"market": "string",
"customerKey": "string",
"sessionKey": "string",
"name": "string",
"nameToken": "string",
"panel": "string",
"token": "string",
"arguments": {}, //Optional,
//key/val arguments for this sub-panel
"attributes": {} //Optional,
//key/val local attributes for this sub-panel
}
]
Arguments
Arguments specified in the request body should NOT be prepended with arg.
.
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 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 | A SHA256 customer key, dynamic page name, or sub-panel name 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 books-and-movies
containing two sub-panels and based on the predefined public panel /top-sellers
is requested.
[
{
"name": "top-selling-books",
"nameToken": "8fe60e383b26844e496cdac0c1ad526060116090e95797e7bbac4f45ed1cf409",
"panel": "/top-sellers",
"arguments": {
"filter": "category:\'book\'"
},
"attributes": {
"panelId": "125"
}
},
{
"name": "top-selling-movies",
"nameToken": "31a93b91446c88f442a1ee25dd0a44293f874d767f154599612aa57c052debdf",
"panel": "/top-sellers",
"arguments": {
"filter": "category:\'movie\'"
}
}
]
cURL¶
#!/bin/bash
curl -i \
-X POST \
-T request-body.json \
-H "Content-Type: application/json" \
"https://{cluster-id}.api.esales.apptus.cloud/api/v1/dynamic-pages/books-and-movies?market=UK&customerKey=930a5da9-5fa8-4d1b-949a-3623c8ec661a&sessionKey=f6c2b175-9e98-49cf-8f25-bd004744cc21&arg.window_first=1&arg.window_last=3&nameToken=1740c017b6d980df4f9348727384d088c7e1ad3fe7e022c81a1fc8a16333bcaf"
Response¶
JSON
{
"topSellingBooks":[{
"name": "top-selling-books",
"ticket": "Oy9keW5hbWljLXBhZ2VzL2Jvb2tzLWFuZC1tb3ZpZXMvdG9wLXNlbGxpbmctYm9va3M7IzsjOyM7IzsjOyM7Izs",
"path": "/dynamic-pages/books-and-movies/top-selling-books",
"displayName": "Top Sellers",
"description": "Lists the most sold products right now.",
"attributes": {
"panelId": "125"
},
"resultType": "products",
"products": [{
"key": "P1",
"ticket": "Oy9keW5hbWljLXBhZ2VzL2Jvb2tzLWFuZC1tb3ZpZXMvdG9wLXNlbGxpbmctYm9va3M7Iztwcm9kdWN0X2tleTtQMTAxMzc1MjY7IztPQkpFQ1RJVkUkO05PTkU6Tk9ORTs3Nzs",
"variants": [],
"attributes": {
"product_key": "P1",
"rank": "1",
"relevance": "1.0",
"title": "The Getaway - Diary of a Wimpy Kid ",
"authors": "Jeff Kinney"
}
},
{
"key": "P2",
"ticket": "Oy9keW5hbWljLXBhZ2VzL2Jvb2tzLWFuZC1tb3ZpZXMvdG9wLXNlbGxpbmctYm9va3M7Iztwcm9kdWN0X2tleTtQMTA2OTE3MzM7IztPQkpFQ1RJVkUkO05PTkU6Tk9ORTs3Nzs",
"variants": [],
"attributes": {
"product_key": "P2",
"rank": "2",
"relevance": "0.5",
"title": "Wonder",
"authors": "R. J. Palacio"
}
},
{
"key": "P3",
"ticket": "Oy9keW5hbWljLXBhZ2VzL2Jvb2tzLWFuZC1tb3ZpZXMvdG9wLXNlbGxpbmctYm9va3M7Iztwcm9kdWN0X2tleTtQMTA4MTM1Nzc7IztPQkpFQ1RJVkUkO05PTkU6Tk9ORTs3Nzs",
"variants": [],
"attributes": {
"product_key": "P3",
"rank": "3",
"relevance": "0.3333333333333333",
"title": "Origin",
"authors": "Dan Brown"
}
}]
}],
"topSellingMovies": [{
"name": "top-selling-movies",
"ticket": "Oy9keW5hbWljLXBhZ2VzL2Jvb2tzLWFuZC1tb3ZpZXMvdG9wLXNlbGxpbmctbW92aWVzOyM7IzsjOyM7IzsjOyM7",
"path": "/dynamic-pages/books-and-movies/top-selling-movies",
"displayName": "Top Sellers",
"description": "Lists the most sold products right now.",
"attributes": {},
"resultType": "products",
"products": [{
"key": "P4",
"ticket": "Oy9keW5hbWljLXBhZ2VzL2Jvb2tzLWFuZC1tb3ZpZXMvdG9wLXNlbGxpbmctbW92aWVzOyM7cHJvZHVjdF9rZXk7UDEwMTM3ODI5OyM7T0JKRUNUSVZFJDtOT05FOk5PTkU7Nzc7",
"variants": [],
"attributes": {
"product_key": "P4",
"rank": "1",
"relevance": "1.0",
"title": "Justice League"
}
},
{
"key": "P5",
"ticket": "Oy9keW5hbWljLXBhZ2VzL2Jvb2tzLWFuZC1tb3ZpZXMvdG9wLXNlbGxpbmctbW92aWVzOyM7cHJvZHVjdF9rZXk7UDEwMTM4MTIxOyM7T0JKRUNUSVZFJDtOT05FOk5PTkU7Nzc7",
"variants": [],
"attributes": {
"product_key": "P5",
"rank": "2",
"relevance": "0.5",
"title": "Thor: Ragnarok"
}
},
{
"key": "P6",
"ticket": "Oy9keW5hbWljLXBhZ2VzL2Jvb2tzLWFuZC1tb3ZpZXMvdG9wLXNlbGxpbmctbW92aWVzOyM7cHJvZHVjdF9rZXk7UDEwMTM4MTI0OyM7T0JKRUNUSVZFJDtOT05FOk5PTkU7Nzc7",
"variants": [],
"attributes": {
"product_key": "P6",
"rank": "3",
"relevance": "0.3333333333333333",
"title": "Murder on the Orient Express"
}
}]
}]
}