Skip to content

Latest commit

 

History

History
89 lines (71 loc) · 2.98 KB

api.md

File metadata and controls

89 lines (71 loc) · 2.98 KB

IUT RPG - API

User

Overview

Retrieve general user information.

URL

/api/get_user

Parameters:

  • id - The id of the user (required).

Response

A JSON dict containing user information, if such user is found.

{
    "id_user"                : 1,        // ID of the user
    "firstname"              : "Rick",   // Firstname of the user
    "lastname"               : "Astley", // Lastname of the user
    "promotion_year"         : 2017,     // Year of the first year at the IUT
    "join_date"              : "2007-03-29 12:42:42", // Join date, in UTC
    "score"                  : 75,       // Global score of the user
    "count_easy"             : 13,       // Amount of 'easy' (1) achievements completed
    "count_normal"           : 9,        // Amount of 'normal' (2) achievements completed
    "count_hard"             : 8,        // Amount of 'hard' (3) achievements completed
    "count_hardcore"         : 5,        // Amount of 'hardcore' (4) achievements completed
    "count_impossible"       : 0,        // Amount of 'impossible' (5) achievements completed
    "global_rank"            : 42,       // Global rank of the user
    "year_rank"              : 42,       // User's rank among the others in their class (promotion_year) 
    "completed_achievements" : [ // IDs of the completed achievements by the user
        1, 20, 42, 69, ...
    ]
}

Achievement

Overview

Retrieve general achievement information.

URL

/api/get_achievement

Parameters:

  • id - The id of the achievement (required).

Response

A JSON dict containing achievement information, if such achievement is found.

{
    "id_achievement" : 1, // ID of the achievement
    "name"           : "Never Gonna Give You Up",        // Name of the achievement (short)
    "lore"           : "We'll never gonna let you down", // Description of the achievement (long)
    "difficulty"     : 5, // Difficulty: 1 - Easy, 2 - Normal, 3 - Hard, 4 - Hardcore, 5 - Impossible
    "auto_complete"  : 0, // Is auto-completed when all childs are completed: 1 - true, 0 - false
    "childs"         : [ // IDs of the childs of the achievement
        2, 3, 42, 69, ...
    ]
}

Leaderboard

Overview

Retrieve information about leaderboard.

URL

/api/get_leaderboard

Parameters:

  • year - The year of the leaderboard. Optional, default is global leaderboard.

Response

A JSON dict containing leaderboard information, and the users on the leaderboard.

{
    "year"  : 0, // Year of the leadboard. 0 if global leaderboard
    "users" : [{ // Users in the leaderboard, order by their score
        "id_user"        : 1, // ID of the user
        "name"           : "Rick Astley", // Name of the user (firstname + lastname)
        "promotion_year" : "2017", // Year of first year at the IUT
        "score"          : 42, // Total score
    }, { ... }, ...]
}