Skip to content

Dynamic Page

Dynamic pages is a concept which makes it possible to retrieve content from several panels at once, without pre-defining 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 re-use 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
name string Unique name of dynamic page type. books-and-dvds
esales.sessionKey string A unique id. UUID / GUID 2F75A...EAFA6
esales.customerKey string Visitor id. UUID / GUID. 5G7HJ...R77T1
panel string Path to public panel. /top-sellers
esales.market string Visitor Market Sweden

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.

Request body

{
    "name": "string",
    "arguments": {}, // Optional, key/val arguments for all sub-panels

    "subpanels": [
        {
            "name": "string",
            "panel": "string",
            "arguments": { } // Optional, key/val arguments 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.

Examples

Try out the API at the Apptus API Playground with your eSales Playground and API credentials.

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": {},

    "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 \
-d @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.sessionKey=b106299c-eac0-4f6f-96d2-93e57c255784&esales.customerKey=d9528030-509c-4e0f-b585-7168f1e9feca"

Response

    {
    "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": {},
            "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": {},
            "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": {}
                            }
                        ]
                    }
                }
            ]
        }
    ]
}
×