Skip to content

POST /api/quiz/{quizId}/questions

POST
/api/quiz/{quizId}/questions

Authorizations

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

Parameters

Path Parameters

quizId*
Typestring
Required

Request Body

JSON
{
"id": 1,
"text": "You are at a store for a pickup. What should you do?",
"durationInSeconds": 60,
"wikilink": "https://wiki.foodsharing.de/some_page",
"failurePoints": 2,
"answers": [
{
"id": 1,
"text": "Take every thing I see with me.",
"explanation": "You should not do that. Obviously.",
"answerRating": null
}
],
"commentCount": 0
}

Responses

Success
JSON
{
"description": "Id of the created question",
"type": "integer"
}
Authorization
api_key
Variables
Key
Value
quizId*
cURL
curl -X POST \
'http://localhost/api/quiz/{quizId}/questions' \
 --data '{
  "id": 1,
  "text": "You are at a store for a pickup. What should you do?",
  "durationInSeconds": 60,
  "wikilink": "https://wiki.foodsharing.de/some_page",
  "failurePoints": 2,
  "answers": [
    {
      "id": 1,
      "text": "Take every thing I see with me.",
      "explanation": "You should not do that. Obviously.",
      "answerRating": null
    }
  ],
  "commentCount": 0
}'

Samples

cURL
curl -X POST http://localhost/api/quiz/{quizId}/questions
JavaScript
fetch("http://localhost/api/quiz/{quizId}/questions", { 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");
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")
print(response.json())