Leaderboard

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

Get Leaderboard Entries

GET https://api.motar.io/leaderboard/v1

Returns leaderboard entries for your app using category filters.

Query Parameters

Name
Type
Description

limit

integer

Number of results to return per page.

page

integer

Results page to return.

categories

array

Leaderboard categories to return. Can be an array or a comma-seperated string.

Headers

Name
Type
Description

Authorization

string

Auth token generated by user login.

{ 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 User Rank

GET https://api.motar.io/leaderboard/v1/rank

Returns a leaderboard entry and the rank of a specific user.

Path Parameters

Name
Type
Description

Authorization

string

Auth token generated by user login.

Query Parameters

Name
Type
Description

categories

string

Leaderboard categories to return. Can be an array or a comma-seperated string.

user

string

User ID of the user to search for. If omitted the API will return the rank of the querying user.

{ 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 }

Add/Update Leaderboard Entry

PUT https://api.motar.io/leaderboard/v1

Adds or updates the leaderboard entry for the logged-in user.

Query Parameters

Name
Type
Description

categories

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.

score

integer

A numeric score indicator generated by your app.

Headers

Name
Type
Description

Authorization

string

Auth token generated by user login.

{ 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 }

Last updated