SearchRecommendations
Retrieves recommendations for a profile in a specific domain. The profile is identified
using a search key, which consists of a KeyName and a KeyValues list.
The KeyName can be a predefined key (for example, _profileId,
_phone, _email) or a custom-defined key.
The search key must match exactly one profile. If no profile matches the search key, the
operation returns a ResourceNotFoundException. If more than one profile matches
the search key, the operation returns a BadRequestException. You can use the
SearchProfiles API to review the matching profiles.
Request Syntax
POST /domains/DomainName/recommendations HTTP/1.1
Content-type: application/json
{
"CandidateIds": [ "string" ],
"Context": {
"string" : "string"
},
"Diversity": {
"Enabled": boolean,
"Values": {
"string" : number
}
},
"KeyName": "string",
"KeyValues": [ "string" ],
"MaxRecommendations": number,
"Metadata": {
"Columns": [ "string" ]
},
"Recommender": {
"Filters": [
{
"Name": "string",
"Values": {
"string" : "string"
}
}
],
"Name": "string",
"PromotionalFilters": [
{
"Name": "string",
"PercentPromotedItems": number,
"PromotionName": "string",
"Values": {
"string" : "string"
}
}
]
}
}
URI Request Parameters
The request uses the following URI parameters.
- DomainName
-
The unique name of the domain.
Length Constraints: Minimum length of 1. Maximum length of 64.
Pattern:
^[a-zA-Z0-9_-]+$Required: Yes
Request Body
The request accepts the following data in JSON format.
- CandidateIds
-
A list of item IDs to rank for the user. Use this when you want to re-rank a specific set of items rather than getting recommendations from the full item catalog. Required for personalized-ranking use cases.
Type: Array of strings
Array Members: Maximum number of 50 items.
Length Constraints: Minimum length of 1. Maximum length of 255.
Required: No
- Context
-
The contextual metadata used to provide dynamic runtime information to tailor recommendations.
Type: String to string map
Key Length Constraints: Minimum length of 1. Maximum length of 64.
Key Pattern:
^[a-zA-Z0-9_.-]+$Value Length Constraints: Minimum length of 1. Maximum length of 255.
Required: No
- Diversity
-
Runtime diversity configuration for this request. Enables diversity-aware recommendations and optionally supplies values for placeholder-based diversity caps configured on the recommender.
Type: RecommendationDiversityConfig object
Required: No
- KeyName
-
A searchable identifier of a customer profile. You can use a predefined key, such as
_profileId,_phone, or_email, or a custom-defined key.Type: String
Length Constraints: Minimum length of 1. Maximum length of 64.
Pattern:
^[a-zA-Z0-9_-]+$Required: Yes
- KeyValues
-
A list of key values. Provide one value for each field of the search key.
Type: Array of strings
Array Members: Minimum number of 1 item. Maximum number of 10 items.
Length Constraints: Minimum length of 1. Maximum length of 255.
Required: Yes
- MaxRecommendations
-
The maximum number of recommendations to return. The default value is 5.
Type: Integer
Valid Range: Minimum value of 1. Maximum value of 500.
Required: No
- Metadata
-
Configuration for metadata to include in recommendation responses.
Type: RecommendationMetadata object
Required: No
- Recommender
-
The recommender used to generate the recommendations.
Type: Recommender object
Required: Yes
Response Syntax
HTTP/1.1 200
Content-type: application/json
{
"ProfileId": "string",
"Recommendations": [
{
"CatalogItem": {
"AdditionalInformation": "string",
"Attributes": {
"string" : "string"
},
"Category": "string",
"Code": "string",
"CreatedAt": number,
"Description": "string",
"Id": "string",
"ImageLink": "string",
"Link": "string",
"Name": "string",
"Price": "string",
"Type": "string",
"UpdatedAt": number
},
"Score": number
}
]
}
Response Elements
If the action is successful, the service sends back an HTTP 200 response.
The following data is returned in JSON format by the service.
- ProfileId
-
The unique identifier of the profile for which to retrieve recommendations.
Type: String
Pattern:
[a-f0-9]{32} - Recommendations
-
List of recommendations generated by the recommender.
Type: Array of Recommendation objects
Errors
For information about the errors that are common to all actions, see Common Error Types.
- AccessDeniedException
-
You do not have sufficient access to perform this action.
HTTP Status Code: 403
- BadRequestException
-
The input you provided is invalid.
HTTP Status Code: 400
- InternalServerException
-
An internal service error occurred.
HTTP Status Code: 500
- ResourceNotFoundException
-
The requested resource does not exist, or access was denied.
HTTP Status Code: 404
- ThrottlingException
-
You exceeded the maximum number of requests.
HTTP Status Code: 429
See Also
For more information about using this API in one of the language-specific AWS SDKs, see the following: