Tutorial 1: Display movie recommendations
Step 1: Register your first user
curl -X POST "https://api.sherpa.ai/v2/auth/register" \
-H "accept: application/json" \
-H "Accept-Language: es-ES" \
-H "Time-Zone: Europe/Madrid" \
-H "content-type: application/json" \
-d "{
\"apiKey\": \"XXXX-SHERPA-DELIVERED-PUBLIC-APIKEY-XXXX\",
\"email\": \"demo@sherpa.ai\",
\"password\": \"chooseYourStrongPassword\",
\"name\": \"demo\",
\"device\": \"demo-device\"
}"
{
"token": "XXXX-SHERPA-TOKEN-XXXX",
"type": "basic",
"expires": :1858915823282,
"username": "demo"
}
Step 2: Log in that user to get a token
curl -X POST "https://api.sherpa.ai/v2/auth/login" \
-H "accept: application/json" \
-H "Accept-Language: es-ES" \
-H "Time-Zone: Europe/Madrid" \
-H "content-type: application/json" \
-d "{
\"apiKey\": \"XXXX-SHERPA-DELIVERED-PUBLIC-APIKEY-XXXX\",
\"email\": \"demo@sherpa.ai\",
\"password\": \"chooseYourStrongPassword\",
\"deviceId\": \"demo-device\",
\"lat\": 43.3017218,
\"lon\": -2.9735617
}"
{
"token": "XXXX-SHERPA-TOKEN-XXXX",
"type": "basic",
"expires": :1858915823282
}
Step 3: Complete the onboarding process
curl -X GET "https://api.sherpa.ai/v2/onboarding/start" \
-H "Authorization: Basic XXXX-SHERPA-TOKEN-XXXX"
-H "accept: application/json" \
-H "content-type: application/x-www-form-urlencoded" \
-H "Accept-Language: en" \
[
{
"id": 5010,
"type": "SHOW_MESSAGE",
"payload": {
"message": "Hello and welcome to the new Sherpa. "
},
"next": 5020
},
{
"id": 5020,
"type": "SHOW_MESSAGE",
"payload": {
"message": "Even though we've already met, I'd like to know more about you."
},
"next": 5040
},
{
"id": 5040,
"type": "WAIT_ACK",
"payload": {
"message": "Ready to begin?",
"ack": "Yes, let's begin",
"colorAck": "",
"textColorAck": ""
},
"next": 5060
},
{
"id": 5060,
"type": "WAIT_INPUT",
"payload": {
"message": "First of all, tap 'Send' if you’d like me to continue calling you %%USERNAME%%. If not, please tell me what you’d like to be called.",
"parameter": "name",
"preference": "USERNAME",
"defaultValue": "test ",
"validation": {
"retries": 2,
"regExps": []
}
},
"next": null
}
]
Step 4: Display movie recommendations
curl -X GET "https://api.sherpa.ai/v2/items/movies" \
-H "Authorization: Basic XXXX-SHERPA-TOKEN-XXXX" \
-H "Accept-Language: en-US" \
-H "Time-Zone: Europe/Madrid" \
-H "Sherpa-Request-Info:{\"lat\":43.3017218, \"lon\":-2.9735617}"
{
"itemTitle": "Back to the future",
"itemSubtitle": "AMC Mercado 20",
"itemText": "Back to the future. AMC Mercado 20",
"dataId": "6d81cc0f-e235-4f01-b8ab-83add0743627",
"movie": {
"averageRating": 8.2,
"certification": {
"name": "12A",
"minAge": 12,
"forChildren": true
},
"poster": "http://image.tmdb.org/t/p/w780/pbXg7LEYh8rdlG2Km5IGZPnhcnuSz.jpg",
"title": "Back to the future"
},
"theater": {
"name": "AMC Mercado 20",
"address": "3111 Mission College Blvd, Santa Clara, CA 95054, United States",
"schedule": "[Proyeccion [horaSesion=12:15 PM - 1:00 PM - 1:45 PM - 2:10 PM - 3:15 PM - 4:00 PM - 4:45 PM - 5:00 PM - 5:45 PM - 6:15 PM - 7:00 PM - 7:45 PM - 8:00 PM - 9:15 PM - 10:00 PM - 10:45 PM]]",
"lat": 37.3892184,
"lon": -121.982836
}
}
Step 5: Profiling: Improve your recommendations by registering user interactions (likes, dislikes)
curl -X POST "https://api.sherpa.ai/v2/profile/feedback/like/10000" \
-H "Authorization: Basic XXXX-SHERPA-TOKEN-XXXX"
curl -X POST "https://api.sherpa.ai/v2/profile/feedback/dislike/10000" \
-H "Authorization: Basic XXXX-SHERPA-TOKEN-XXXX"