QCM REST API (1.0)

Download OpenAPI specification:Download

API to handle a QCM between teachers and students.

auth-controller

Auth Controller

Returns Json Web Token for the user to authenticates in his following requests

Request Body schema: application/json

data

role
string
Enum: "TEACHER" "STUDENT" "ADMIN"
username
string

Responses

200

The JWT

201

Created

400

The credentials supplied aren't correct

401

Unauthorized

403

Forbidden

404

Not Found

post /auth/login
https://localhost:8080/auth/login

Request samples

Content type
application/json
Copy
Expand all Collapse all
{
  • "role": "TEACHER",
  • "username": "string"
}

qcm-controller

Qcm Controller

View the list of all qcm

query Parameters
name
string

Responses

200

Successfully retrieved list

401

Unauthorized

403

You are not authenticated

404

Not Found

get /qcm/all
https://localhost:8080/qcm/all

View the list of QCMs created by the given user

query Parameters
name
string

Responses

200

Successfully retrieved list

401

Unauthorized

403

You are not authenticated

404

Not Found

get /qcm/mines
https://localhost:8080/qcm/mines

Creates a new qcm

query Parameters
name
string

Responses

200

Successfully created qcm

401

Unauthorized

403

You are not a teacher

404

Not Found

get /qcm/new
https://localhost:8080/qcm/new

View a qcm with a given id

path Parameters
id
required
integer <int32>

id

query Parameters
name
string

Responses

200

Successfully retrieved qcm

401

Unauthorized

403

You are not authenticated

404

The qcm you were trying to reach is not found

get /qcm/{id}
https://localhost:8080/qcm/{id}

Updates a qcm

path Parameters
id
required
integer <int32>

id

query Parameters
name
string
Request Body schema: application/json

newQcm

id
integer <int32>
name
string
questions
Array of objects (Question)
state
string
Enum: "COMPLETE" "INCOMPLETE" "STARTED" "FINISHED"

Responses

200

Successfully updated qcm

201

Created

400

The qcm is malformed

401

Unauthorized

403

You are not the owner of this qcm

404

The qcm you were trying to reach is not found

put /qcm/{id}
https://localhost:8080/qcm/{id}

Request samples

Content type
application/json
Copy
Expand all Collapse all
{
  • "id": 0,
  • "name": "string",
  • "questions":
    [
    ],
  • "state": "COMPLETE"
}

Deletes a qcm

path Parameters
id
required
integer <int32>

id

query Parameters
name
string

Responses

200

Successfully deleted qcm

204

No Content

401

Unauthorized

403

You are not the owner of this qcm

404

The qcm you were trying to reach is not found

delete /qcm/{id}
https://localhost:8080/qcm/{id}

View the current question of a qcm

path Parameters
id
required
integer <int32>

id

query Parameters
name
string

Responses

200

Successfully returned the current question

401

Unauthorized

403

You are not authenticated

404

The qcm you were trying to reach is not found

get /qcm/{id}/currentQuestion
https://localhost:8080/qcm/{id}/currentQuestion

Ends a qcm

path Parameters
id
required
integer <int32>

id

query Parameters
name
string

Responses

200

Successfully ended qcm

401

Unauthorized

403

You are not the owner of this qcm

404

The qcm you were trying to reach is not found

get /qcm/{id}/finish
https://localhost:8080/qcm/{id}/finish

Launches a qcm

path Parameters
id
required
integer <int32>

id

query Parameters
name
string

Responses

200

Successfully launched qcm

401

Unauthorized

403

You are not the owner of this qcm

404

The qcm you were trying to reach is not found

get /qcm/{id}/launch
https://localhost:8080/qcm/{id}/launch

Pass to the next question

path Parameters
id
required
integer <int32>

id

query Parameters
name
string

Responses

200

Successfully passed to the next question

401

Unauthorized

403

You are not the owner of this qcm

404

Not Found

get /qcm/{id}/nextQuestion
https://localhost:8080/qcm/{id}/nextQuestion

Get the result of a qcm. A teacher can see all responses but a student can only see his result

path Parameters
id
required
integer <int32>

id

query Parameters
name
string

Responses

200

Successfully view the result

401

Unauthorized

403

You are not authenticated

404

The qcm you were trying to reach is not found

get /qcm/{id}/result
https://localhost:8080/qcm/{id}/result

question-controller

Question Controller

Get whether the current user has responded to the question with the given question id

path Parameters
id
required
integer <int32>

id

query Parameters
name
string

Responses

200

Successfully retrieved result

401

Unauthorized

403

You are not authenticated or you are a teacher

404

Question with given id not found

get /question/{id}/hasAnswered
https://localhost:8080/question/{id}/hasAnswered

View the list of responses for a given question

path Parameters
id
required
integer <int32>

id

Responses

200

Successfully retrieved list

401

Unauthorized

403

You are not authenticated

404

Not Found

get /question/{id}/responses
https://localhost:8080/question/{id}/responses

response-controller

Response Controller

Posts responses

query Parameters
name
string
Request Body schema: application/json

cIds

ids
Array of integers <int32>

Responses

200

Successfully posted the response

201

Created

400

The user has already responded for a given question

401

Unauthorized

403

You are not a student

404

A choice hasn't been found

post /response/
https://localhost:8080/response/

Request samples

Content type
application/json
Copy
Expand all Collapse all
{
  • "ids":
    [
    ]
}

user-controller

User Controller

Get list of all users

Responses

200

Successfully get the list

401

Unauthorized

403

You are not a teacher

404

Not Found

get /users/all
https://localhost:8080/users/all

Get the current user

query Parameters
name
string

Responses

200

Successfully get the user

401

Unauthorized

403

You are not authenticated

404

Not Found

get /users/me
https://localhost:8080/users/me

Get list of all students

Responses

200

Successfully get the list

401

Unauthorized

403

You are not a teacher

404

Not Found

get /users/students
https://localhost:8080/users/students

Get list of all teachers

Responses

200

Successfully get the list

401

Unauthorized

403

You are not a teacher

404

Not Found

get /users/teachers
https://localhost:8080/users/teachers