Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

3. Define the dynamic parameters & add their accessors to the JSON SCHEME

As defined in Narrative API - Technical Reference , there are several cases of dynamic parameters specially managed by Boxalino Narrative API. You should set them as parameters (and add their accessors to the JSON SCHEME) in the following cases:

Case

Parameter Name

Parameter Value

Layout Block is a container of products

bx-hits

accessor

Layout Block displays one specific product

bx-hit

accessor

Layout Block displays a list of facets (filtering options)

bx-facets

accessor

Layout Block displays a pagination control (user can go to the next, previous or other pages of the result list)

bx-pagination

accessor

Layout Block displays the title of search results

bx-search-title

accessor

Layout Block displays the currently selected product list sorting options

bx-sort

accessor

Layout Block displays the number of results

bx-hitCount

accessor

Layout Block displays is a container of search autocomplete textual suggestions

bx-acQueries

accessor

Layout Block displays a specific textual suggestion

bx-acQuery

accessor

Info

The value can always be set to “accessor”

In all of these cases, make sure to add a string property called accessor to the list of properties of your JSON SCHEME, like this:

Code Block
"accessor": {
  "type": "string",
  "description": "hits accessor (typically leave empty)"
}

This will enable the Narrative administrator to select another widget than the main one (by default).

Info

For example, if your Narrative contains several blocks of product recommendations, one of them (probably the first one) will be the connected to the main widget of the Narratives, but the other ones will create additional requests to other widgets. The Narrative administrator can then define the name of the widget in this accessor parameter. By knowing which accessor is defined, the Boxalino Narrative API will return the correct dynamic information.

Annex #1 - Typical Layout Blocks

We give here the full JSON (not only the schema the full json of the Layout Block you can import using the bottom-left Import button of the Layout Blocks list view.

Info

The JSONs are always provided below as list with one element, so you can directly copy & paste them in the import text-area which expects to receive not only one element, but a list of elements.

product_list

Container of “product” Layout Blocks.

Info

must contain the parameter bx-hits with the value “accessor”

Code Block
languagejson
[
  {
    "uniqueKey": "product_list",
    "parametersJsonScheme": "{\n  \"title\": \"Label\",\n  \"type\": \"object\",\n  \"properties\": {\n    \"title\": {\n      \"type\": \"object\",\n      \"title\": \"Label\",\n      \"properties\": {\n        \"de\": {\n          \"type\": \"string\",\n          \"description\": \"label in German\"\n        },\n        \"fr\": {\n          \"type\": \"string\",\n          \"description\": \"label in French\"\n        }\n      }\n    },\n    \"see_all_label\": {\n      \"type\": \"object\",\n      \"title\": \"See all link label\",\n      \"properties\": {\n        \"de\": {\n          \"type\": \"string\",\n          \"description\": \"see all link label in German\"\n        },\n        \"fr\": {\n          \"type\": \"string\",\n          \"description\": \"see all link label in French\"\n        }\n      }\n    },\n    \"see_all_link\": {\n      \"type\": \"object\",\n      \"title\": \"See all link\",\n      \"properties\": {\n        \"de\": {\n          \"type\": \"string\",\n          \"description\": \"see all link in German\"\n        },\n        \"fr\": {\n          \"type\": \"string\",\n          \"description\": \"see all link in French\"\n        }\n      }\n    },\n    \"accessor\": {\n      \"type\": \"string\",\n      \"description\": \"hits accessor (typically leave empty)\"\n    }\n  }\n}",
    "format": null,
    "widgets": [],
    "parameters": [
      {
        "name": "template",
        "values": [
          "product-list"
        ]
      },
      {
        "name": "model",
        "values": [
          "product-list"
        ]
      },
      {
        "name": "content-resource",
        "values": [
          "c-r=t"
        ]
      },
      {
        "name": "bx-hits",
        "values": [
          "accessor"
        ]
      }
    ],
    "subRenderings": [],
    "route": "visual-elements",
    "reqParams": null,
    "$fromServer": true,
    "parentResource": null,
    "restangularCollection": false,
    "isSelected": true
  }
]

product

Display of one product in a grid or a slider.

Info

must contain the parameter bx-hit with the value “accessor”

Code Block
languagejson
[
  {
    "uniqueKey": "product",
    "parametersJsonScheme": "{\n  \"title\": \"Product\",\n  \"type\": \"object\",\n  \"properties\": {\n    \"accessor\": {\n      \"type\": \"string\",\n      \"description\": \"hits accessor (typically leave empty)\"\n    }\n  }\n}",
    "format": null,
    "widgets": [],
    "parameters": [
      {
        "name": "template",
        "values": [
          "product"
        ]
      },
      {
        "name": "model",
        "values": [
          "product"
        ]
      },
      {
        "name": "content-resource",
        "values": [
          "c-r=t"
        ]
      },
      {
        "name": "bx-hit",
        "values": [
          "accessor"
        ]
      }
    ],
    "subRenderings": [],
    "route": "visual-elements",
    "reqParams": null,
    "$fromServer": true,
    "parentResource": null,
    "restangularCollection": false,
    "isSelected": true
  }
]

facet_list

Display a list of faces (filtering options).

Info

must contain the parameter bx-facets with the value “accessor”

Code Block
languagejson
[
  {
    "uniqueKey": "facet_list",
    "parametersJsonScheme": "{\n  \"title\": \"Facets\",\n  \"type\": \"object\",\n  \"properties\": {\n    \"accessor\": {\n      \"type\": \"string\",\n      \"description\": \"facet accessor (typically leave empty)\"\n    }\n  }\n}",
    "format": null,
    "widgets": [],
    "parameters": [
      {
        "name": "template",
        "values": [
          "facet-list"
        ]
      },
      {
        "name": "model",
        "values": [
          "facet-slider"
        ]
      },
      {
        "name": "content-resource",
        "values": [
          "c-r=t"
        ]
      },
      {
        "name": "position",
        "values": [
          "left"
        ]
      },
      {
        "name": "bx-facets",
        "values": [
          "accessor"
        ]
      }
    ],
    "subRenderings": [],
    "route": "visual-elements",
    "reqParams": null,
    "$fromServer": true,
    "parentResource": null,
    "restangularCollection": false,
    "isSelected": true
  }
]

pagination

Display a pagination block (so the user can change the current page)

Info

must contain the parameter bx-pagination with the value “accessor”

Code Block
languagejson
[
  {
    "uniqueKey": "pagination",
    "parametersJsonScheme": "{\n  \"title\": \"Pagination\",\n  \"type\": \"object\",\n  \"properties\": {\n    \"accessor\": {\n      \"type\": \"string\",\n      \"description\": \"hits accessor (typically leave empty)\"\n    }\n  }\n}",
    "format": null,
    "widgets": [],
    "parameters": [
      {
        "name": "template",
        "values": [
          "pagination"
        ]
      },
      {
        "name": "model",
        "values": [
          "pagination"
        ]
      },
      {
        "name": "content-resource",
        "values": [
          "c-r=t"
        ]
      },
      {
        "name": "bx-pagination",
        "values": [
          "accessor"
        ]
      }
    ],
    "subRenderings": [],
    "route": "visual-elements",
    "reqParams": null,
    "$fromServer": true,
    "parentResource": null,
    "restangularCollection": false,
    "isSelected": true
  }
]

search_title

Display a pagination block (so the user can change the current page)

Info

must contain the parameter bx-search-title with the value “accessor”

must also contains in the JSON schema a parameter called “title” and a parameter called bx_alternate_title so that a different label can be defined if an auto-correction occurred.

In the Narrative API response, the parameter bx_alternate_title can be ignored because the right value is always returned in the “title” parameter.

Code Block
languagejson
[
  {
    "uniqueKey": "search_title",
    "parametersJsonScheme": "{\n  \"title\": \"Title (H1)\",\n  \"type\": \"object\",\n  \"properties\": {\n    \"title\": {\n      \"type\": \"object\",\n      \"title\": \"Normal Search Title\",\n      \"properties\": {\n        \"de\": {\n          \"type\": \"string\",\n          \"description\": \"normal search titlein German\"\n        },\n        \"fr\": {\n          \"type\": \"string\",\n          \"description\": \"normal search title in French\"\n        }\n      }\n    },\n    \"bx_alternate_title\": {\n      \"type\": \"object\",\n      \"title\": \"Corrected Search Title\",\n      \"properties\": {\n        \"de\": {\n          \"type\": \"string\",\n          \"description\": \"corrected search title in German\"\n        },\n        \"fr\": {\n          \"type\": \"string\",\n          \"description\": \"corrected search titlein French\"\n        }\n      }\n    },\n    \"accessor\": {\n      \"type\": \"string\",\n      \"description\": \"facet accessor (typically leave empty)\"\n    }\n  }\n}",
    "format": null,
    "widgets": [],
    "parameters": [
      {
        "name": "template",
        "values": [
          "title"
        ]
      },
      {
        "name": "model",
        "values": [
          "title"
        ]
      },
      {
        "name": "content-resource",
        "values": [
          "c-r=t"
        ]
      },
      {
        "name": "bx-search-title",
        "values": [
          "accessor"
        ]
      }
    ],
    "subRenderings": [],
    "route": "visual-elements",
    "reqParams": null,
    "$fromServer": true,
    "parentResource": null,
    "restangularCollection": false,
    "isSelected": true
  }
]

autocomplete_text_list

Container of “autocomplete_text” Layout Blocks.

Info

must contain the parameter bx-acQueries with the value “accessor”

Code Block
languagejson
[
  {
    "uniqueKey": "autocomplete_text_list",
    "parametersJsonScheme": "{\n  \"title\": \"Autocomplete Text List\",\n  \"type\": \"object\",\n  \"properties\": {\n    \"accessor\": {\n      \"type\": \"string\",\n      \"description\": \"ac-queries accessor (typically leave empty)\"\n    }\n  }\n}",
    "format": null,
    "widgets": [],
    "parameters": [
      {
        "name": "template",
        "values": [
          "autocomplete-text-list"
        ]
      },
      {
        "name": "model",
        "values": [
          "autocomplete-text-list"
        ]
      },
      {
        "name": "content-resource",
        "values": [
          "c-r=t"
        ]
      },
      {
        "name": "bx-acQueries",
        "values": [
          "accesssor"
        ]
      }
    ],
    "subRenderings": [],
    "route": "visual-elements",
    "reqParams": null,
    "$fromServer": true,
    "parentResource": null,
    "restangularCollection": false,
    "isSelected": true
  }
]

autocomplete_text

Display one specific autocomplete textual suggestion (search as you type).

Info

must contain the parameter bx-acQuery with the value “accessor”

Code Block
languagejson
[
  {
    "uniqueKey": "autocomplete_text",
    "parametersJsonScheme": "{\n  \"title\": \"Autocomplete Text\",\n  \"type\": \"object\",\n  \"properties\": {\n    \"accessor\": {\n      \"type\": \"string\",\n      \"description\": \"autocomplete accessor (typically leave empty)\"\n    }\n  }\n}",
    "format": null,
    "widgets": [],
    "parameters": [
      {
        "name": "template",
        "values": [
          "autocomplete-text"
        ]
      },
      {
        "name": "model",
        "values": [
          "autocomplete-text"
        ]
      },
      {
        "name": "content-resource",
        "values": [
          "c-r=t"
        ]
      },
      {
        "name": "bx-acQuery",
        "values": [
          "accessor"
        ]
      }
    ],
    "subRenderings": [],
    "route": "visual-elements",
    "reqParams": null,
    "$fromServer": true,
    "parentResource": null,
    "restangularCollection": false,
    "isSelected": true
  }
]