Skip to content

Formation API

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

Listing existing formations, quizzes and videos

GET / (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 / (gets details about the formation requested)

Parameters

name type data type description
None required int 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/{id}' -H 'Authorization: Bearer {jwt}'
GET / (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 / (gets details about the quiz requested)

Parameters

name type data type description
None required int 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/{id}' -H 'Authorization: Bearer {jwt}'
GET / (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/{userEmail}' -H 'Authorization: Bearer {jwt}'

Setting score of the selected quiz for the connected user

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

Parameters

name type data type description
None required int 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}"

Listing existing videos

GET / (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}'

Clone this wiki locally