Technology Engineering & Design
Quiz API Guide
Use this page to learn how to request quiz questions and submit answers through the class API.
1. Choose your terminal
Select the environment you are using. The API is the same; only some command syntax differs.
2. API address
All requests are sent to:
https://quiz.example.com/api
Replace quiz.example.com with the actual class quiz subdomain.
3. Test the API
This request checks whether the quiz server is available.
Example response:
{
"status": "ok"
}
4. Get your next question
Your instructor will provide an access token. Send it with the request so the server knows which quiz attempt belongs to you.
Example response:
{
"question_id": 14,
"question": "Which document explains the expectations for this course?",
"choices": {
"A": "The syllabus",
"B": "The lunch menu",
"C": "The school map",
"D": "The bus schedule"
}
}
5. Submit an answer
Send the question ID and your selected answer. The server records the answer and can return the next question.
Example response:
{
"accepted": true,
"next_question": {
"question_id": 15,
"question": "What should you do before using unfamiliar equipment?",
"choices": {
"A": "Use it immediately",
"B": "Ask for instruction",
"C": "Guess how it works",
"D": "Ignore safety procedures"
}
}
}
6. Important API concepts
- GET
- Requests information from the server.
- POST
- Sends information to the server.
- Header
- Extra information sent with a request, such as your authorization token.
- JSON
- The text format used to exchange structured information with the API.
- HTTP status code
- A number showing whether a request succeeded or failed, such as 200, 401, or 404.
Keep your token private
Do not share your access token with another student. The server uses it to identify your quiz attempt.