🏆 Engagement
1. Get started
If you haven't already, install the Damoov-Admin SDK for Python.
pip install damoov-admin
Begin by importing the Accounts module and finalizing the authentication process.
from damoov_admin import engagement
email="[email protected]"
password="YOUR PASSWORD"
enagage = engagement.DamoovAuth(email=email, password=password)
2. Methods
Syntaxes:
user_id
: unique user id, also known as a devicetokenleaders_count
: a number of records displayed at the top list, also known as a list of TOP-Xround_users_count
: a number of records around the user positionratingtype
: 1 - Acceleration score; 2 - Braking score; 3 - phone usage score; 4 - Speeding score; 5 - Cornering score; 6 - Overall score; 7 - Distance; 8 - Number of Trips; 9 - Driving time
get_user_leaderboard
get_user_leaderboard
Get a list of user's rankings
Parameters
user_id
: unique user identifies, also known as DeviceToken
Request:
leaderboard=engage.get_user_leaderboard(
user_id=''
)
Response:
{
"Result": {
"DeviceToken": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"Nickname": "",
"FirstName": "Jon",
"LastName": "Lee",
"Image": "",
"Place": 111,
"AccelerationPlace": 120,
"DecelerationPlace": 89,
"DistractionPlace": 64,
"SpeedingPlace": 149,
"TurnPlace": 123,
"DistancePlace": 6,
"DurationPlace": 2,
"TripsPlace": 2,
"AccelerationPerc": 0.5110431080361895,
"DecelerationPerc": 0.41937200638637573,
"DistractionPerc": 0.20582756785524214,
"SpeedingPerc": 0.58102714209686,
"TurnPerc": 0.5113092070250133,
"Perc": 0.44278871740287384,
"AccelerationScore": 71.66666666666667,
"DecelerationScore": 78,
"DistractionScore": 91.66666666666667,
"SpeedingScore": 66,
"TurnScore": 85.33333333333333,
"Score": 87.33333333333333,
"Distance": 54200.37006316686,
"Duration": 79858.8166666665,
"Trips": 3290,
"UsersNumber": 176
},
"Status": 200,
"Title": "",
"Errors": []
}
get_general_leaderboard
get_general_leaderboard
Get a list of user's rankings
Parameters
user_id
: unique user identifies, also known as DeviceToken
Request:
leaderboard=engage.get_general_leaderboard(
user_id='',
leaders_count=5, # default value is 5
round_users_count = 2, #defaul value is 2
ratingtype = 1
)
Response:
{
"Result": {
"UsersNumber": 176,
"ScoringRate": "Rate",
"Users": [
{
"DeviceToken": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"Nickname": "Brown Bear",
"FirstName": null,
"LastName": null,
"Image": "",
"Value": 100,
"ValuePerc": 0.005721128259712613,
"Place": 1,
"IsCurrentUser": false,
"Distance": 143001.93584607943,
"Duration": 58003.48333333333,
"Trips": 141
},
{
"DeviceToken": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"Nickname": "Curious Alpaca",
"FirstName": "",
"LastName": "",
"Image": "",
"Value": 99,
"ValuePerc": 0.024348057477381585,
"Place": 2,
"IsCurrentUser": false,
"Distance": 17927.34328114066,
"Duration": 19063.166666666657,
"Trips": 774
},
{
"DeviceToken": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"Nickname": "",
"FirstName": "",
"LastName": "",
"Image": "",
"Value": 99,
"ValuePerc": 0.025146354443853113,
"Place": 3,
"IsCurrentUser": false,
"Distance": 4042.1870771363087,
"Duration": 9156.699999999999,
"Trips": 706
},
{
"DeviceToken": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"Nickname": "Wise Python",
"FirstName": null,
"LastName": null,
"Image": "",
"Value": 88,
"ValuePerc": 0.4372006386375732,
"Place": 108,
"IsCurrentUser": false,
"Distance": 229.37779835841144,
"Duration": 457.4666666666668,
"Trips": 20
},
{
"DeviceToken": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"Nickname": "Portuguese Man o War",
"FirstName": null,
"LastName": null,
"Image": "",
"Value": 88,
"ValuePerc": 0.43746673762639704,
"Place": 109,
"IsCurrentUser": false,
"Distance": 74.25214937333142,
"Duration": 181.7,
"Trips": 13
},
{
"DeviceToken": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"Nickname": "",
"FirstName": null,
"LastName": null,
"Image": "",
"Value": 88,
"ValuePerc": 0.4385311335816924,
"Place": 110,
"IsCurrentUser": false,
"Distance": 22.633049319699577,
"Duration": 38.75,
"Trips": 2
},
{
"DeviceToken": "",
"Nickname": "Mountain Urial",
"FirstName": "John",
"LastName": "Lee",
"Image": "",
"Value": 87.33333333333333,
"ValuePerc": 0.44278871740287384,
"Place": 111,
"IsCurrentUser": true,
"Distance": 54200.37006316686,
"Duration": 79858.8166666665,
"Trips": 3290
},
{
"DeviceToken": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"Nickname": "African Buffalo",
"FirstName": "",
"LastName": "",
"Image": "",
"Value": 87,
"ValuePerc": 0.4486428951569984,
"Place": 112,
"IsCurrentUser": false,
"Distance": 20673.207226592018,
"Duration": 24498.233333333297,
"Trips": 1520
},
{
"DeviceToken": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"Nickname": "",
"FirstName": "",
"LastName": "",
"Image": "",
"Value": 87,
"ValuePerc": 0.44890899414582225,
"Place": 113,
"IsCurrentUser": false,
"Distance": 18548.51123303635,
"Duration": 27953.24999999994,
"Trips": 1262
},
{
"DeviceToken": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"Nickname": "Baby Elephant",
"FirstName": "",
"LastName": "",
"Image": "",
"Value": 87,
"ValuePerc": 0.4559606173496541,
"Place": 114,
"IsCurrentUser": false,
"Distance": 987.7633770721168,
"Duration": 2008.4166666666663,
"Trips": 100
}
]
},
"Status": 200,
"Title": "",
"Errors": []
}
Updated 11 months ago