-
Notifications
You must be signed in to change notification settings - Fork 0
Documentation API
GET | /categories_with_iq |
---|---|
Description | Get all categories with the IQ of current User |
Result Type | JSON |
Authentification mandatory? | Yes |
Controller | |
Parameters | - |
Failure cases | User is not authentificated - 401 |
Success response exemple:
[
{
"category_id": 1,
"category_name":"animals",
"image_path": "https://pathToImage.jpg",
"user_iq":"107",
},
{
"category_id": 2,
"category_name":"movies",
"image_path": "https://pathToImage.jpg",
"user_iq":"96",
},
...
]
GET | /global_leaderboard |
---|---|
Description | Get the 10 global best best players |
Result Type | JSON |
Authentification mandatory? | Yes |
Controller | |
Parameters | - |
Failure cases | User is not authentificated - 401 |
Success response infos:
JSON array are ordered. The first element of the list is the first player, and it then goes in descending order
The array must contains at maximum 10 entry. If there is less than 10 entry, it means that there is less than 10 players in the database.
Score calculation is still not decided, scores in example may not be representative of real data.
Success response example:
[
{
"user_id":123,
"user_name":"Strogator",
"user_score":1890
},
{
"user_id":3,
"user_name":"Krucksy",
"user_score":1800
},
...
]
GET | /global_user_position |
---|---|
Description | Get the position in leaderboard and score of current user |
Result Type | JSON |
Authentification mandatory? | Yes |
Controller | |
Parameters | - |
Failure cases | User is not authentificated - 401 |
Success response example:
{
"user_rank": 45,
"user_score": 1000
}
GET | /question/{category_id} |
---|---|
Description | Set the current question for the user, and return the question |
Result Type | JSON |
Authentification mandatory? | Yes |
Controller | |
Parameters | category_id: ID of the question's category |
Failure cases | User is not authentificated - 401 Category does not exist - 404 |
Success response example
{
"question_id":1,
"category_id":1,
"category_name":"animals",
"question":"What is the fastest animal in the world?"
}
GET | /question/options |
---|---|
Description | Get the options for the user's current question |
Result Type | JSON |
Authentification mandatory? | Yes |
Controller | |
Parameters | - |
Failure cases | User is not authentificated - 401 |
Success response example:
{
"question_id":1,
"number_of_options":4,
"options:" {
"234:"the panther",
"432":"the cheetah",
"234":"the jaguar",
"324":"the leopard",
}
}
POST | /question |
---|---|
Description | add a question to the community category |
Result Type | JSON |
Authentification mandatory? | Yes |
Controller | |
Parameters | - |
Failure cases | User is not authentificated - 401 |
Request body example:
{
"question": "How old is Harry Potter at the beginning of the first book?",
"options": [
"11",
"15",
"He wasn't born"
],
"answer": "1"
}
Success response example:
{
"question": "How old is Harry Potter at the beginning of the first book?",
"options": [
"11",
"15",
"He wasn't born"
],
"answer": "1"
}
POST | /question/answer/option |
---|---|
Description | Send answer to current question, as one of the proposed options |
Result Type | JSON |
Authentification mandatory? | Yes |
Controller | |
Parameters | - |
Failure cases | User is not authentificated - 401 User did not ask for options - 403 |
request body example:
{
"answer":"232"
}
success response examples:
{
"user_is_correct":true,
"right_answer":"1",
"answer_sent":"1"
}
or
{
"user_is_correct":false,
"right_answer":"1",
"answer_sent":"he wasn't born"
}
POST | /question/answer/text |
---|---|
Description | Send answer to current question, as text |
Result Type | JSON |
Authentification mandatory? | Yes |
Controller | |
Parameters | - |
Failure cases | User is not authentificated - 401 User already asked for options - 403 |
Request body example: { "answer":"he wasn't born" }
success response examples:
{
"user_is_correct":true,
"right_answer":"1",
"answer_sent":"1"
}
or
{
"user_is_correct":false,
"right_answer":"1",
"answer_sent":"he wasn't born"
}
GET | /leaderboard/{category_id} |
---|---|
Description | Get best players in category |
Result Type | JSON |
Authentification mandatory? | Yes |
Controller | |
Parameters | - |
Failure cases | User is not authentificated - 401 Category does not exist - 404 |
Success response example:
[
{
"user_id":123,
"user_name":"Strogator",
"user_iq":150
},
{
"user_id":3,
"user_name":"Krucksy",
"user_iq":136
},
...
]
GET | /user_position/{category_id} |
---|---|
Description | Get user rank and IQ in category |
Result Type | JSON |
Authentification mandatory? | Yes |
Controller | |
Parameters | - |
Failure cases | User is not authentificated - 401 Category does not exist - 404 |
Success response example:
{
"user_rank": 45,
"user_iq": 108
}
GET | /user_iq/{category_id} |
---|---|
Description | Get user IQ in category |
Result Type | JSON |
Authentification mandatory? | Yes |
Controller | |
Parameters | - |
Failure cases | User is not authentificated - 401 Category does not exist - 404 |
Success response example:
{
"user_iq": 108
}
POST | /login |
---|---|
Description | Authentificate user |
Result Type | - |
Authentification mandatory? | No |
Controller | |
Parameters | - |
Failure cases | Login credentials unvalid - 401 |
POST | /register |
---|---|
Description | Create new user account |
Result Type | - |
Authentification mandatory? | No |
Controller | |
Parameters | - |
Failure cases | Username already taken - 409 |