APIs for mapping data

Store raw Category, Attribute and Product data in a helper collection, then reindex from it.

Last updated

On this page

Overview

Athena XAI offers raw data mapping for three types: Category, Attributes and Products. After mapping succeeds, you can start a reindex process. The raw collection is auxiliary storage for this data, which Athena XAI indexing uses later.

To enable the helper collection on a website, set the “Use Raw data from NoSQL” field to “Yes” in the Super Admin.

Execution order matters. Map attributes and categories first, then map products.

Attribute Mapping API

The Attribute Reindexing API creates attributes from the feed of attributes you pass in the request body.

MethodPath
POST/api/v1/mapping/attributes
POST/api/v2/mapping/attributes

Request body

JSON
{
   "token" : "{{ website_token }}", //required
   "data" : {
       "attributes" : [ //required, array of objects
           {
               "id": "93",
               "code": "color",
               "options": [
                    {
                       "value": "5476",
                       "label": "Black",
                       "hex_code": "#000000"
                    },
                    {
                       "value": "5485",
                       "label": "Red",
                       "hex_code": "#ff0000"
                    },
                    {
                        "value": "5486",
                        "label": "White",
                        "hex_code": "#ffffff"
                    },
                    {
                        "value": "5487",
                        "label": "Yellow",
                        "hex_code": "#ffff00"
                    }
                ]
            }
        ]
   }
}

Successful response

JSON
{
    "status": 200,
    "message": "Success"
}

Category Mapping API

The Category Reindexing API creates categories from the feed of categories you pass in the request body. The feed should follow the Category Feed page.

MethodPath
POST/api/v1/mapping/categories
POST/api/v2/mapping/categories

Request body

JSON
{
   "token" : "{{ website_token }}", //required
   "data" : {
       "categories" : [ //required, array of objects
           {
                "id": "17",
                "parent_id": "12",
                "parent_name": "Tops",
                "level": "4",
                "name": "Tanks",
                "image": null,
                "url": "http://example.local.com/men/tops-men/tanks-men.html",
                "path": "Men > Tops > Tanks",
                "category_size": 12
            },
            {
                "id": "18",
                "parent_id": "13",
                "parent_name": "Bottoms",
                "level": "4",
                "name": "Pants",
                "image": "http://example.local.com/bottoms-category-image.html",
                "url": "http://example.local.com/men/bottoms-men/pants-men.html",
                "path": "Men > Bottoms > Pants",
                "category_size": 12
            }
        ]
   }
}

Successful response

JSON
{
    "status": 200,
    "message": "Success"
}

Product Mapping API

The Product Mapping API stores raw data in auxiliary collections for later indexing. It supports incremental updates, so you can send data in parts.

Two parameters signal the start and the completion of the mapping process: start_reindex and end_reindex.

MethodPath
POST/api/v1/products/rawData
POST/api/v2/products/rawData

Request body

JSON
{
  "token": "{{ website_token }}", //required
  "start_reindex": true,
  "end_reindex": true,
  "data": {
    "products": [ //required, array of objects
      {
        "entity_id": "1",
        "attribute_set_id": "15",
        "type_id": "simple",
        "sku": "24-MB01",
        "has_options": "0",
        "required_options": "0",
        "created_at": "2021-07-26 08:02:14",
        "updated_at": "2021-07-26 08:02:14",
        "visibility": "4",
        "status": "1",
        "name": "Joust Duffle Bag",
        "image": "http://magento.local.com/media/catalog/product/cache/96b5f3e5d9a5953212deef43723952d6/m/b/mb01-blue-0.jpg",
        "small_image": "/m/b/mb01-blue-0.jpg",
        "thumbnail": "/m/b/mb01-blue-0.jpg",
        "url_key": "joust-duffle-bag",
        "price": "32.000000",
        "description": "The sporty Joust Duffle Bag can't be beat - not in the gym, not on the luggage carousel, not anywhere. Big enough to haul a basketball or soccer ball and some sneakers with plenty of room to spare, it's ideal for athletes with places to go.Dual top handles.Adjustable shoulder strap.Full-length zipper.>L 29\" x W 13\" x H 11\".",
        "store_id": 1,
        "total_reviews": 2,
        "reviews": 50,
        "link": "http://magento.local.com/joust-duffle-bag.html",
        "full_image_path": "http://magento.local.com/media/catalog/product/m/b/mb01-blue-0.jpg",
        "stock": 1,
        "attributes": {
          "color": "49,50",
          "size": "91",
          "materijal_prevlakeee": "46844"
        },
        "categories": [
          "3",
          "4"
        ],
        "salable_qty": 100
      }
    ]
  }
}

Successful response

JSON
{
    "status": 200,
    "message": "Success"
}