Skip to content

Formation API

Liam Boudadi edited this page Feb 6, 2025 · 19 revisions

Listing existing formations, quizzes and videos

GET /formations (gets all in-memory formations details)

Parameters

None

Responses

http code content-type response
200 json [{"id": {int}, "name": {string}, "description": {string}}, ...]

Example cURL

 curl -L -X GET 'http://localhost:8080/formation/formations' -H 'Authorization: Bearer {jwt}'
GET /{formationId} (gets details about the formation requested)

Parameters

name type data type description
formationId required int The specific formation id

Responses

http code content-type response
200 json {"id": {int}, "name": {string}, "description": {string}}
404 N/A

Example cURL

 curl -L -X GET 'http://localhost:8080/formation/{formationId}' -H 'Authorization: Bearer {jwt}'
GET /quizzes (gets all in-memory quizzes details)

Parameters

None

Responses

http code content-type response
200 json [{"id": {int}, "json": {string}}, ...]

Example cURL

 curl -L -X GET 'http://localhost:8080/formation/quizzes' -H 'Authorization: Bearer {jwt}'
GET quiz/{quizId} (gets details about the quiz requested)

Parameters

name type data type description
quizId required int The specific quiz id

Responses

http code content-type response
200 json {"id": {int}, "json": {string}}
404 N/A N/A

Example cURL

 curl -L -X GET 'http://localhost:8080/formation/quiz/{quizId}' -H 'Authorization: Bearer {jwt}'
GET /quizzes/scores (gets all the quiz scores of the connected user)

Parameters

None

Responses

http code content-type response
200 json [{"userEmail": {string}, "quizId": {int}, "score": {float}}, ...]
404 N/A N/A

Example cURL

 curl -L -X GET 'http://localhost:8080/formation/quizzes/scores' -H 'Authorization: Bearer {jwt}'
GET quiz/score/{quizId} (gets the selected quiz score of the connected user)

Parameters

name type data type description
quizId required int The specific quiz id

Responses

http code content-type response
200 float The corresponding float
404 N/A N/A

Example cURL

 curl -L -X GET 'http://localhost:8080/formation/quiz/score/{quizId}' -H 'Authorization: Bearer {jwt}'
GET /videos (gets all in-memory videos details)

Parameters

None

Responses

http code content-type response
200 json [{"id": {int}, "title": {string}, "description": {string}, "url": {string}}, ...]

Example cURL

 curl -L -X GET 'http://localhost:8080/formation/videos' -H 'Authorization: Bearer {jwt}'

Post / Update scores and quizzes, videos attributes

POST /quiz/score/{quiId} (set the score of the selected quiz for the connected user)

Parameters

name type data type description
quizId required int The specific quiz id

Responses

http code content-type response
200 string Score saved successfully
500 string Error saving score
400 json {"timestamp": {string}, "status": 400, "error": "Bad Request", "path": "/formation/quiz/score"}

Example cURL

 curl -L -X POST "http://localhost:8080/formation/quiz/score" -H "Authorization: Bearer {jwt}" -H "Content-Type: application/json" --data-raw "{\"userEmail\": \"email.test@gmail.com\",\"quizId\": 1,\"score\": 2}"

Clone this wiki locally