1 Answer
- Newest
- Most votes
- Most comments
0
The GetRecommendations API request and response payload you shared above does not match the API definition. Are you using a language SDK or calling the Personalize endpoint directly?
If making a REST call directly to the Personalize campaign/recommender endpoint, the request payload should be in the following format.
{ "campaignArn": "string", "context": { "string" : "string" }, "filterArn": "string", "filterValues": { "string" : "string" }, "itemId": "string", "numResults": number, "recommenderArn": "string", "userId": "string" }
If using a language SDK like the AWS SDK for Python, the request parameters are passed as arguments to a function that wraps the REST call.
import boto3 personalizeRt = boto3.client('personalize-runtime') response = personalizeRt.get_recommendations( campaignArn = 'Campaign ARN', userId = 'User ID', numResults = 10 ) print("Recommended items") for item in response['itemList']: print (item['itemId'])
See examples here.
answered 2 years ago
Relevant content
- asked 7 months ago
- Accepted Answerasked 4 months ago
- AWS OFFICIALUpdated 3 years ago
- AWS OFFICIALUpdated a month ago
- AWS OFFICIALUpdated 2 years ago
I use boto3 library. I don't have any error with putting item or getting them, but in special cases which I describe above, if putting item has
\n
or similiar in properties, I get wrong data - I expect to get{'ItemId': '1, 'score': 0.1}
, but getting{'ItemId': 'next line', 'score': 0.1}.
Example:I get response using next code, but instead of
{'itemList': [{'ItemId': 'next line', 'score': 0.1}]}