Skip to content

API Version 1: Leaderboard

Alexander Chen edited this page May 8, 2018 · 4 revisions

GET /app/api/v1/leaderboard

This route requires authentication. It returns the leaderboard of users, automatically arranged by descending number of points. The response contains a leaderboard property, which is an array of user objects (with a limited subset of user information). Each user object in the leaderboard array has the following schema:

{
    activity: Array,
    firstName: String,
    lastName: String,
    major: String,
    picture: String,
    points: Number,
    uuid: String,
    year: Number
}

An example request for the leaderboard:

$ curl -H "Authorization: Bearer <token>" localhost/app/api/v1/leaderboard
{
    "error": null,
    "leaderboard": [
        {
            "activity": [ActivityObject, ... ActivityObject],
            "firstName": "Abdul",
            "lastName": "Taheri",
            "major": "Computer Science",
            "picture": "http://path.to/image/for/abdul",
            "points": 135,
            "uuid": "efcc6dc1-5d03-4054-a269-6721d65c2478",
            "year": 2
        },
        {
            "activity": [ActivityObject, ... ActivityObject],
            "firstName": "Nina",
            "lastName": "Kim",
            "major": "Electrical Engineering",
            "picture": "http://path.to/image/for/nina",
            "points": 130,
            "uuid": "bcdde9e6-a4e9-4f54-af0b-2e9fe84dd449",
            "year": 3
        },
        {
            "activity": [ActivityObject, ... ActivityObject],
            "firstName": "Emma",
            "lastName": "Vasquez",
            "major": "Computer Science and Engineering",
            "picture": "http://path.to/image/for/emma",
            "points": 125,
            "uuid": "db27fa2e-2751-47b6-8b1d-d2d6f0486c83",
            "year": 1
        }
    ]
}

Note: ActivityObject is defined here under /app/api/v1/user/activity