Overview
Use the Category API to build category pages, which are pre-filtered product listings based on a category ID. Athena XAI offers a catalog extension for Magento 2 and an Open API.
The Category API is similar to the Search API, but the request body differs. The Search API needs a query parameter, while the Category API requires a category ID and its level.
Endpoint
| Method | Path |
|---|---|
POST | /api/v1/category/data |
POST | /api/v2/category/data |
Request body
{
"category": "14", //required, this is an id of your category
"level": "2", //required, this the level of your category in the Category tree
"token": "{{ website_token }}" //required
}
Successful response
{
"data": {
"products": {
"results": [
{
"short_description": null,
"salable_qty": 1500,
"link": "https://m.com/beaumont-summit-kit.html",
"description": "Product Description",
"availability": 1,
"configurable_options": [
{
"attribute_id": 93,
"options": [
{
"option_label": "Orange",
"hash_code": "#eb6703",
"option_type": "1",
"option_id": "56",
"seo_value": "orange"
},
{
"option_label": "Red",
"hash_code": "#ff0000",
"option_type": "1",
"option_id": "58",
"seo_value": "red"
}
],
"attribute_code": "color"
}
],
"category_names": [
"Accessories",
"Belts",
"Men"
],
"price": {
"regular_price": 42,
"regular_price_with_currency": "$42.00",
"special_price": null,
"special_price_with_currency": null,
"loyalty_price": null,
"loyalty_price_with_currency": null,
"discount_percentage": 0
},
"product_score": 45,
"id": 270,
"sku": "MJ01",
"views": 0,
"image": "https://m.com/media/catalog/product/63_1.jpeg",
"meta_title": null,
"product_type_id": "configurable",
"meta_description": null,
"product_combinations": [
{
"color": "56",
"size": "166"
},
{
"color": "58",
"size": "166"
}
],
"name": "Beaumont Summit Kit",
"total_reviews": 2,
"child_products": [
{
"image": "https://m.com/media/catalog/product//m/j/main_1.jpg",
"stock_status": true,
"color": "56",
"size": "166",
"hover_image": "https://m.com/media/catalog/product/m/j/main_1.jpg",
"configurable_options": [
{
"type": "color",
"value": "56"
},
{
"type": "size",
"value": "166"
}
],
"entity_id": "255",
"sku": "MJ01-XS-Orange"
}
],
"type": "product",
"category_ids": [
14,
12
]
}
],
"amounts": {
"current_page": 1,
"last_page": 1,
"from": 1,
"to": 11,
"per_page": 15,
"next_page": null,
"prev_page": null,
"total": 11
},
"active_filters": [],
"filters": [
{
"title": "Category",
"type": "category2"
},
{
"title": "Price",
"type": "pri",
"array": [
{
"option_value": " Less than $5",
"option_key": "pri",
"option_label": " Less than $5",
"selected": false,
"count": 0,
"type_id": "0",
"hax_code": null,
"url": "https://m.com/men/tops-men/jackets.html/filter/pri:+Less+than+$5/",
"url_path": "/filter/pri:+Less+than+$5/",
"url_params": {
"pri": "+Less+than+$5"
}
}
]
}
],
"sorters": [
{
"option_key": "product_list_order",
"option_value": "price_asc",
"option_label": "Price",
"url": "https://m.com/men/tops-men/jacke.html/filter/product_list_order:price_asc/",
"url_path": "/filter/product_list_order:price_asc/",
"url_params": {
"product_list_order": "price_asc"
},
"selected": false
},
{
"option_key": "product_list_order",
"option_value": "name_asc",
"option_label": "Name",
"url": "https://m.com/men/tops-men/jacket.html/filter/product_list_order:name,asc/",
"url_path": "/filter/product_list_order:name,asc/",
"url_params": {
"product_list_order": "name_asc"
},
"selected": true
}
],
"orders": [
{
"option_key": "product_list_limit",
"option_value": 15,
"option_label": "15",
"url": "https://m.com/men/tops-men/jackets-men.html/filter/product_list_limit:15/",
"url_path": "/filter/product_list_limit:15/",
"url_params": {
"product_list_limit": "15"
},
"selected": true
},
],
"pager": [],
"collection_price": {
"lowest_price_with_filters": 42,
"highest_price_with_filters": 99,
"lowest_price": 42,
"highest_price": 99
},
"visual_filter": {
"title": "Color",
"type": "color"
}
},
"modes": [
{
"name": "Grid",
"type": "grid",
"option_key": "product_list_mode",
"option_value": "grid",
"option_label": "Grid",
"url": "https://m.com/men/tops-men/jackets-men.html/filter/product_list_mode:grid/",
"url_path": "/filter/product_list_mode:grid/",
"url_params": {
"product_list_mode": "grid"
},
"selected": true
},
{
"name": "List",
"type": "list",
"option_key": "product_list_mode",
"option_value": "list",
"option_label": "List",
"url": "https://m.com/men/tops-men/jackets-men.html/filter/product_list_mode:list/",
"url_path": "/filter/product_list_mode:list/",
"url_params": {
"product_list_mode": "list"
}
}
],
"current_url": "https://m.com/men/tops-men/jackets-men.html",
"current_path": "",
"is_seo_enabled": true,
}
}