This guide shows you how to migrate from using an older Recommendations API version to using a newer one.
Migrating from v1 to v2
Changes in v2
- The API expects a request to include at least one parameter for filtering the recommendation data. This means that you need to define at least one parameter in each of your recommendation configurations.
- Parameters are now defined inside the
- You can define multiple values for a given parameter by using an array of strings.
- You can exclude specific products from the recommendation data by defining the corresponding product IDs in the request.
For more information about the API, see Recommendations API v2.
Updating your code for v2
To migrate from v1 to v2, update your recommendation configurations and requests as follows:
If a recommendation configuration has no parameters, define at least one parameter in the configuration, and update the requests that target the recommendation accordingly.
In requests, enclose parameters inside the
Optionally, optimize your request code:
If you're requesting the same recommendation with the same parameters multiple times, but with different parameter values, combine the separate requests into a single request by defining the parameter values as an array of strings.
If you're requesting a product recommendation and want to exclude specific products from the returned recommendation data, use
excludeIdsto define the corresponding product IDs.