Pages

To create a new recommendation configuration for a site, make a Graniitti API POST request to /sites/<site_id>/recommendations. Include the new recommendation configuration as a JSON object in the request body. For more information about the object, see the recommendation configuration reference.

curl -X POST \
--header 'Authorization: Bearer <access_token>' \
--header 'Content-Type: application/json' \
-d '{<recommendation_configuration>}' \
'https://<graniitti_api_base_url>/sites/<site_id>/recommendations'

Here's an example of a recommendation configuration to pass in the POST request:

Request body example
{
    "name": "Most purchased products",
    "description": "Top 5 most purchased products in the past 10 days",
    "type": "most_converted",
    "frequency": "1d",
    "hours": 240,
    "limit": 5,
    "map_ids": "product",
    "params": [
        "id",
        "type",
        "price"
    ],
    "options": {
        "product_attrs": [
            "id",
            "type",
            "price"
        ]
    },
    "filters": null
}

If the request is successful, the Frosmo Platform queues the new recommendation configuration for data generation.

To check the status of the data generation, retrieve the recommendation configuration (optionally with the fields=status query parameter to minimize the response size) and check the status property in the returned object.

You can also check the status in the Frosmo Control Panel.

Once the recommendation data has been successfully generated, you can use it in a modification to build and display a recommendation. You retrieve the data with the Recommendations API.