vocabulary/docs/api.md

1.5 KiB

API

Base path: /api-vocab. Swagger UI: /api-vocab/swagger-ui/index.html. Errors return a JSON body with status and message.

Method Path Notes
GET /enums/levels
GET /enums/quiz-types TYPING, MULTIPLE_CHOICE
POST /user/login {name, password}; the password is never returned
GET /user/{id}, /user/name?name=
GET /words, /words/{id}, /words/search?search=
POST /words create or update
PUT /words/level-updater {wordId, level}
GET /quizzes, /quizzes/{id}, /quizzes/user-name?name=
GET /quizzes/search?search=&name= name is optional and limits the result to one user
POST /quizzes/start-new {quizName, quizLevel, quizType, userName}; defaults are ALL and TYPING; 409 if the name is used
POST /quizzes/next-qa?id= next unanswered question; question is null when the quiz is finished
GET /quizzes/options?qaPairId= {qaPairId, options[4]}; 400 for typing questions
GET /quizzes/hint?qaPairId= sample sentence
POST /quizzes/answer {quizId, qaPair: {id, answer}}; the first answer is final; multiple-choice answers must be one of the options
POST /quizzes/score answers the last question and returns the scoreboard
GET /reports/{user}, /reports/search?user=&search= only answered questions are counted; optional quizType returns only the words answered in that type