Skip to content
This repository has been archived by the owner on Jul 27, 2020. It is now read-only.

APIv1.Endpoints

alexandrepiveteau edited this page May 28, 2020 · 1 revision

Table of Contents

List of endpoints

Moderator

Note: When using one of these endpoint, a new token will be generated.

POST /register

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.

PUT /mod/{idModerator}/password

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.

PUT /mod/{idModerator}/username

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.

DELETE /mod/{idModerator}

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.

Token

POST /auth

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.

User connection

POST /connect

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

Poll

GET /mod/{idModerator}/poll

Get all available polls.

A moderator token is needed.

On success, a list of polls will be returned.

GET /mod/{idModerator}/poll/{idPoll}

Get poll with id idPoll.

A (user/moderator) token is needed.

On success, the poll will be returned.

POST /mod/{idModerator}/poll

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.

PUT /mod/{idModerator}/poll/{idPoll}

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.

DELETE /mod/{idModerator}/poll/{idPoll}

Deletes a poll.

A moderator token is needed.

On success, this message is returned by the server:

{
  "message" : "Poll deleted"
}

Session

GET /session

Get the correct session corresponding with the given token.

A user token is needed.

On success, the server will send a session object.

GET /mod/{idModerator}/poll/{ídPoll}/session

Get the last active session for a given poll.

A moderator token is needed.

On success, a Session object is sent by the server.

PUT /mod/{idModerator}/poll/{ídPoll}/session

Creates or updates the state of a session. A Session object should be sent in the request's body.

A moderator token is needed

Question

GET /mod/{idModerator}/poll/{idPoll}/question

Get all questions forming a poll.

A (user/moderator) token is needed.

On success, a list of questions will be returned.

GET /mod/{idModerator}/poll/{idPoll}/question/{idQuestion}

Get question with id idQuestion

A (user/moderator) token is needed.

On success, the question will be returned.

POST /mod/{idModerator}/poll/{idPoll}/question

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.

PUT /mod/{idModerator}/poll/{idPoll}/question/{idQuestion}

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.

DELETE /mod/{idModerator}/poll/{idPoll}/question/{idQuestion}

Deletes a question.

A moderator token is needed.

On success, this message is returned by the server:

{
  "message" : "Question deleted"
}

Answer

GET /mod/{idModerator}/poll/{idPoll}/question/{idQuestion}/answer

Get answers forming a question.

A (user/moderator) token is needed.

On success, a list of answers will be returned.

GET /mod/{idModerator}/poll/{idPoll}/question/{idQuestion}/answer/{idAnswer}

Get the answer with id idAnswer

A (user/moderator) token is needed.

On success, the answer will be returned.

POST /mod/{idModerator}/poll/{idPoll}/question/{idQuestion}/answer

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.

PUT /mod/{idModerator}/poll/{idPoll}/question/{idQuestion}/answer/{idAnswer}

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.

DELETE /mod/{idModerator}/poll/{idPoll}/question/{idQuestion}/answer/{idAnswer}

Deletes an answer.

A moderator token is needed.

On success, this message is returned by the server:

{
  "message" : "Answer deleted"
}

PUT /mod/{idModerator}/poll/{idPoll}/question/{idQuestion}/answer/{idAnswer}/vote

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

Statistics

GET /mod/{idModerator}/poll/{idPoll}/statistics

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.

POST /mod/{idModerator}/poll/{idPoll}/question/{idQuestion}/statistics

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.

Errors

On error, a message indicating why the error occured must be sent:

{
  "error" : "Something terrible happened"
}

RockinApp - Wiki

Home

Policy

Organisation

Collaboration

Meetings

Rapport

API

Home

Endpoints

Objects

Frontend

Android

Structure

Installation

Elm

Structure

Installation

Backend

Base de donnée

Presentation

Home

Plan

Feedback

Clone this wiki locally