Limit


Limit

The limit parameter allows you to set a limit of the number of questions that you get as a response. Eg: Find 5 random questions

{info} This is NOT a required parameter.

Example

The request that you would use would look something like this:

curl https://quizapi.io/api/v1/questions -G \
-d apiKey=YOUR_API_KEY \
-d limit=10

{success} The default limit is 20 and can not be higher than 20.

As you've set a limit of 10 questions, you would get a a JSON object of 10 entires with the results in an array we can iterate over.


[
  {
    "id": 1,
    "question": "How to delete a directory in Linux?",
    "description": "delete folder",
    "answers": {
      "answer_a": "ls",
      "answer_b": "delete",
      "answer_c": "remove",
      "answer_d": "rmdir",
      "answer_e": null,
      "answer_f": null
    },
    "multiple_correct_answers": "false",
    "correct_answers": {
      "answer_a_correct": "false",
      "answer_b_correct": "false",
      "answer_c_correct": "false",
      "answer_d_correct": "true",
      "answer_e_correct": "false",
      "answer_f_correct": "false"
    },
    "explanation": "rmdir deletes an empty directory",
    "tip": null,
    "tags": [],
    "category": "linux",
    "difficulty": "Easy"
  }
]
...