Skip to main content

Updating a recommendation configuration (Graniitti API)

warning

Be careful when updating a recommendation configuration that is in use, since changes to the recommendation configuration affect all modifications that use the configuration. In particular, if you update a configuration that is currently used in an active variation of an active modification, the changes will affect all visitors who see the variation content.

To update an existing recommendation configuration for a site, make a Graniitti API PUT request to /sites/<site_id>/recommendations/<recommendation_id>, where <recommendation_id> is the ID of the recommendation configuration. Include the updated recommendation configuration as a JSON object in the request body. For more information about the object, see the recommendation configuration reference.

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

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

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

If the request is successful, the Frosmo Platform updates the recommendation configuration.

note

Updating the recommendation configuration does not automatically queue it for data generation. If you want to also regenerate the recommendation data, set the status property to new in the configuration.

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.

tip

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