recommendClient.execute { val query = RecommendationsQuery( indexName = "yourIndexName", model = "bought-together", objectID = "yourObjectID", ) get recommendations List(query)}
let options = RecommendationsOptions(indexName: "IndexName", model: .boughtTogether, objectID: "B018APC4LE") recommendClient.getRecommendations(options: [options]) { result in if case .success(let response) = result { print("Response: \(response)") }}
Parameters
object[]
required
Show child attributes
string
required
Facet attribute for which to get recommendations.
string
required
Name of the index.
enum<string>
required
Name of the recommendation model to use.
One of: bought-together, related-products, trending-items, trending-facets.
string
required
Object ID for which to get recommendations.
number
required
Threshold for the recommendations confidence score (between 0 and 100).
Only recommendations with a greater score are returned.
string
Facet value for which to get recommendations for.
This parameter must be used along with #.
object
Search parameters to use as fallback when there are no recommendations.
integer
Maximum number of recommendations to retrieve.
Depending on the available recommendations and the other request parameters,
the actual number of recommendations may be lower.
If you don’t set maxRecommendations or set it to 0,
all matching recommendations are returned, and no fallback request is performed.
Confidence score of the recommended item.
The closer it is to 100, the more relevant.
Response as JSON
This section shows the JSON response returned by the API.
Each API client wraps this response in language-specific objects, so the structure may vary.
To view the response, use the getLogs method.
Don’t rely on the order of properties—JSON objects don’t preserve key order.