Leaderboard

Reminder: if you are using an app/client ID in sandbox, you must use sandbox.playportal.io as the endpoint for your requests. Requests to api.playportal.io with a sandbox client ID will fail!

get
Get Leaderboard Entries

https://api.playportal.io/leaderboard/v1
Returns leaderboard entries for your app using category filters.
Request
Response
Headers
Authorization
required
string
Auth token generated by user login.
Query Parameters
categories
optional
array
Leaderboard categories to return. Can be an array or a comma-separated string.
page
optional
integer
Results page to return.
limit
optional
integer
Number of results to return per page.
200: OK
Leaderboard entries retrieved.
{ page: 1,
pages: 1,
limit: 10,
total: 3,
docs:
[ { user: [Object], score: 30, categories: [], rank: 1 },
{ user: [Object], score: 20, categories: [], rank: 2 },
{ user: [Object], score: 10, categories: [], rank: 3 } ] }

get
Get User Rank

https://api.playportal.io/leaderboard/v1/rank
Returns a leaderboard entry and the rank of the specific user.
Request
Response
Headers
Authorization
required
string
Auth token generated by user login.
Query Parameters
user
optional
string
User ID of the user to search for. If omitted the API will return the rank of the querying user.
categories
optional
array
Leaderboard categories to return. Can be an array or a comma-separated string.
200: OK
{ user:
{ handle: '@testmom-testerson',
firstName: 'Fenchurch',
lastName: 'Testerson',
userType: 'adult',
accountType: 'Parent',
country: 'US',
profilePic: '5c5350859f9bac71635b1cb5',
coverPhoto: '5c5350859f9bac71635b1cb6',
userId: 'b8535054ffc356af52d97c840cfb64fcc7aacd89492f4fa11bcfbaf919dfa87161ebe6ae33042e9d7aa49fb91eb919ad2a288b259130cfc27d5e3df554a4c3f1c89ee1df161fb993cb5d6b7187c15f871d$f725403d7d4c5ae61427288738ee3c1e',
anonymous: false },
score: 10,
categories: [],
rank: 3 }

put
Add/Update Leaderboard Entry

https://api.playportal.io/leaderboard/v1
Adds or updates a leaderboard entry for the logged-in user.
Request
Response
Headers
Authorization
required
string
Auth token generated by user login.
Query Parameters
score
required
number
A numeric score indicator generated by your app.
categories
optional
array
Leaderboard categories to return. Can be an array or a comma-separated string. If an entry already exists for this user and these categories, it will be updated with the new score. Otherwise as new entry will be created.
200: OK
{ user:
{ handle: '@testkid-testerson1',
firstName: 'Kim',
lastName: 'Testerson',
userType: 'child',
accountType: 'Kid',
country: 'US',
profilePic: '5c5352c6a9ea8e71a90c342c',
coverPhoto: '5c5352c6a9ea8e71a90c342d',
userId: '08fd9073e852cb7d0fc27c4202f93760c9256eff52bdd1bebbbd51ccec77f1294fc4994d62937273507ca0132612d268b9f7961ba2fa234ff7fa2366c6deec066dfd5ccab9af5336706f2cb2f7fac9cb6d$348d12ba7326d8f140bdf37c3b9e66d9',
anonymous: false,
parentFlags: { cameraDisabled: false, proximityFriends: false } },
score: 100,
categories: [ 'test' ],
rank: 1 }