Skip to content

POST /api/quiz/{quizId}/questions/{questionId}/answers

POST
/api/quiz/{quizId}/questions/{questionId}/answers

Authorizations

api_key
Type: API Key (header: X-CSRF-Token)

Parameters

Path Parameters

quizId*
Typestring
Required
questionId*
Typestring
Required

Request Body

JSON
{
"id": 1,
"text": "Take every thing I see with me.",
"explanation": "You should not do that. Obviously.",
"answerRating": null
}

Responses

Success
JSON
{
"description": "Id of the created answer",
"type": "integer"
}
Authorization
api_key
Variables
Key
Value
quizId*
questionId*
cURL
curl -X POST \
'http://localhost/api/quiz/{quizId}/questions/{questionId}/answers' \
 --data '{
  "id": 1,
  "text": "Take every thing I see with me.",
  "explanation": "You should not do that. Obviously.",
  "answerRating": null
}'

Samples

cURL
curl -X POST http://localhost/api/quiz/{quizId}/questions/{questionId}/answers
JavaScript
fetch("http://localhost/api/quiz/{quizId}/questions/{questionId}/answers", { method: "POST" })
  .then(response => response.json())
  .then(data => console.log(data));
PHP
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "http://localhost/api/quiz/{quizId}/questions/{questionId}/answers");
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl_close($ch);
echo $response;
Python
import requests
response = requests.post("http://localhost/api/quiz/{quizId}/questions/{questionId}/answers")
print(response.json())