Search Landing API

Build a dynamic landing page from a Twig template and get the page's content and sidebar as ready-made HTML.

Last updated

On this page

Overview

Use the Search Landing API with the Athena XAI Landing Page Builder to create dynamic landing pages from Athena XAI results.

The API returns the same data as the Search API, but formatted as HTML. All the rules that apply to the Search API also apply to the Search Landing API.

Create a search template

  1. Go to Dev Zone -> Search Templates on the Athena XAI Dashboard.
  2. Create or edit a search template. Templates are in Twig format. You can customize or create multiple templates, but only one can be active.
  3. Publish your template to make it ready for use.

Template variables

You can use these variables in a search template:

NameTypeDescription
productsarray of objectsAn array of products to show on the landing page.
filtersarray of objectsAn array of liters to show on the landing page.
active_filtersarray of objectsAn array of active filters.
modesarray of objectsPage mode (grid or list).
current_modestringCurrent page mode (grid or list).
website_urlstringYour full website URL.
qstring)Search query.
sortersarray of objectsAn array of sorters to show on the landing page.
initial_searchstringInitial sorter.
clear_all_urlstringURL only with the query parameter.
ordersarray of objectsAn array of orders (example: 16, 32, 64, 100).
pagesarray of objectsAn array of pages.
bannersarray of objectsAn array of banners to show on the landing page.
totalResultsintegerTotal number of products.
fromintegerThe number of the first product on the landing page.
tointegerThe number of the last product on the landing page.
min_pricedoubleThe minimal price of filtered products.
max_pricedoubleThe maximal price of filtered products.
min_price_alldoubleThe minimal price of initial products.
max_price_alldoubleThe minimal price of initial products.

How it works

Each Search Landing API call routes through the active search template and generates raw HTML for the page’s content and sidebar. Every API call returns this raw data. After a successful response, place the content on a blank landing page on your platform.

Request body

JSON
{
   "q": "Yoga", //required
   "token": "{{ website_token }}" //required
}

Successful response

JSON
{
   "data": {
      "content": "<div class=\"athena-main\"><div class=\"widget block block-static-block\"></div><div class=\"toolbar toolbar-products\">..."
      "sidebar": "<div class=\"block filter\" id=\"layered-filter-block\" data-collapsible=\"true\">
    <div class=\"block-title filter-title\" data-count=\"0\" role=\"tablist\">..."
   }
}