-
Notifications
You must be signed in to change notification settings - Fork 6
APIv1.Endpoints
- Table of Contents
-
List of endpoints
- Moderator
- Token
- User connection
- Poll
- Session
- Question
-
Answer
GET /mod/{idModerator}/poll/{idPoll}/question/{idQuestion}/answer
GET /mod/{idModerator}/poll/{idPoll}/question/{idQuestion}/answer/{idAnswer}
POST /mod/{idModerator}/poll/{idPoll}/question/{idQuestion}/answer
PUT /mod/{idModerator}/poll/{idPoll}/question/{idQuestion}/answer/{idAnswer}
DELETE /mod/{idModerator}/poll/{idPoll}/question/{idQuestion}/answer/{idAnswer}
PUT /mod/{idModerator}/poll/{idPoll}/question/{idQuestion}/answer/{idAnswer}/vote
- Statistics
- Errors
Note: When using one of these endpoint, a new token will be generated.
Registers a moderator.
The json representation of the moderator needs to be sent in the request's body.
On success, the server will send the moderator back.
Updates the password of a moderator. A moderator token must be provided.
The body of the request should be formatted as so:
{
"currentPassword" : "abcd",
"newPassword" : "1234"
}
On success, a HTTP status 200 should be sent. On failure, the appropriate HTTP status should be sent.
Updates the username of a moderator. A moderator token must be provided.
The body of the request should be formatted as so:
{
"currentPassword" : "abcd",
"newUsername" : "mumfred"
}
On success, a HTTP status 200 should be sent. On failure, the appropriate HTTP status should be sent.
Deletes a moderator. A moderator token must be provided.
The body of the request should be formatted as so:
{
"currentPassword" : "abcd"
}
On success, a HTTP status 200 should be sent. On failure, the appropriate HTTP status should be sent.
Requests a token.
Send the json representation of a moderator in the request's body. This endpoint is designed to be used by moderators.
On success, the server will send the moderator back.
Requests a token for a user connecting to a specified poll.
{
"code" : "0x086F"
}
On success, the server will send a token associated to the user making the request.
The code
consists of a 4-letter-long sequence of hexadecimal digits, prefixed by the "0x"
sequence. Codes must use only capital letters.
The emoji mapping table is as follows :
Emoji | Hex value |
---|---|
✅ | 0 |
🍺 | 1 |
🍔 | 2 |
😻 | 3 |
👻 | 4 |
🦄 | 5 |
🍀 | 6 |
⛄️ | 7 |
🔥 | 8 |
🥳 | 9 |
🥑 | A |
🥶 | B |
🎋 | C |
🌈 | D |
☂️ | E |
🎹 | F |
Get all available polls.
A moderator token is needed.
On success, a list of polls will be returned.
Get poll with id idPoll
.
A (user/moderator) token is needed.
On success, the poll will be returned.
Creates a new poll.
A moderator token is needed. Send the json representation of the poll in the request's body.
On success, the poll is returned by the server.
Updates a poll.
A moderator token is needed. Send the json representation of the poll in the request's body.
On success, the poll is returned by the server.
Deletes a poll.
A moderator token is needed.
On success, this message is returned by the server:
{
"message" : "Poll deleted"
}
Get the correct session corresponding with the given token.
A user token is needed.
On success, the server will send a session object.
Get the last active session for a given poll.
A moderator token is needed.
On success, a Session object is sent by the server.
Creates or updates the state of a session. A Session object should be sent in the request's body.
A moderator token is needed
Get all questions forming a poll.
A (user/moderator) token is needed.
On success, a list of questions will be returned.
Get question with id idQuestion
A (user/moderator) token is needed.
On success, the question will be returned.
Creates a new question.
A moderator token is needed. Send the json representation of the question in the request's body.
On success, the created question will be returned.
Updates a question.
A moderator token is needed. Send the json representation of the question in the request's body.
On success, the modified question will be returned.
Deletes a question.
A moderator token is needed.
On success, this message is returned by the server:
{
"message" : "Question deleted"
}
Get answers forming a question.
A (user/moderator) token is needed.
On success, a list of answers will be returned.
Get the answer with id idAnswer
A (user/moderator) token is needed.
On success, the answer will be returned.
Creates a new answer.
A moderator token is needed. Send the json representation of the answer in the request's body.
On success, the answer will be returned.
Updates an answer.
A moderator token is needed. Send the json representation of the answer in the request's body.
On success, the answer will be returned.
Deletes an answer.
A moderator token is needed.
On success, this message is returned by the server:
{
"message" : "Answer deleted"
}
Votes for an answer.
A user token is needed.
Send the json representation of the vote in the request's body.
On success, a code 200 will be returned
Retrieves the statistics object for a poll.
A moderator token is needed.
On success, a code 200 will be returned, alongside with a statistics object.
Retrieves the statistics object for a question.
A moderator token is needed.
On success, a code 200 will be returned, alongside with a question statistics object.
On error, a message indicating why the error occured must be sent:
{
"error" : "Something terrible happened"
}