The challenge is to create a small API for a quiz app where users can create and attempt quizzes. The users should also be able to see some basic stats about their quiz attempts.
POST:
https://localhost:3000/account/register
request.body:
{
"userName" : "I'm a username",
"password" : "I'm a password"
}
POST:
https://localhost:3000/account/login
request.body:
{
"userName" : "I'm a username",
"password" : "I'm a password"
}
GET:
https://localhost:3000/loggedInOnly/account/logout
POST:
https://localhost:3000/loggedInOnly/quiz
request.body:
{
"title" : "i'm a quiz title",
"quizEntries": [
{
"question": "im a question",
"answer": "im an answer"
},
{
"question": "im a second question",
"answer": "im a second answer"
}
]
}
POST:
https://localhost:3000/loggedInOnly/quiz/:quizId
{
"question" : "question to add to quiz",
"answer" : "answer to add to quiz"
}
DELETE:
https://localhost:3000/loggedInOnly/quiz/:quizId
GET:
https://localhost:3000/loggedInOnly/quiz
GET:
https://localhost:3000/loggedInOnly/:quizId
- register two users as described above
- login as a user and create a quiz
- make a note of the quiz id as provided by the response
- logout or simply login as a different user
- try to manipulate the quiz with the id from first user via delete as described above
-
first get the quiz questions via: GET:
https://localhost:3000/loggedInOnly/play/:quizId -
then post your answers as follows: POST:
https://localhost:3000/loggedInOnly/play/:quizId
request.body:
{
"quizEntries": [
{
"question": "im a question",
"answer": "im an answer"
},
{
"question": "im a second question",
"answer": "im a second answer"
}
]
}