0% found this document useful (0 votes)
8 views10 pages

JSON Quiz Generation with Postman

The document outlines a procedure for generating a JSON Quiz using the Open Trivia Database (OpenTDB) API and testing it with the Postman tool. It includes steps for selecting quiz parameters, generating an API URL, and executing an API request in Postman, along with interpreting the response status codes. The result confirms successful quiz generation and API testing.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views10 pages

JSON Quiz Generation with Postman

The document outlines a procedure for generating a JSON Quiz using the Open Trivia Database (OpenTDB) API and testing it with the Postman tool. It includes steps for selecting quiz parameters, generating an API URL, and executing an API request in Postman, along with interpreting the response status codes. The result confirms successful quiz generation and API testing.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd

GENERATING A JSON QUIZ AND APPLYING API TESTING

USING POSTMAN TOOL

=====================================================================
[Link]. : 1 Student Name :
Date : 30.11.2025 Roll No. :
=====================================================================
Aim
To generate a JSON Quiz using the Open Trivia Database (OpenTDB) API and perform
API testing using the Postman tool.
Procedure
Step 1: Open the Open Trivia Database (OpenTDB) website by navigating to the URL:
[Link]

Step 2: Click on the API option in the website's menu.


Step 3: The API documentation page will be displayed. In this window, specify the following
parameters:
 Number of Questions: Select either 10 or 20.

1
 Category: Choose a category such as Science: Computers or General Knowledge.
 Difficulty Level: Select either Easy, Medium, or Hard.
 Type of Questions: Choose either Multiple Choice Questions or True or False.
 Encoding Option: Select one of the encoding methods:
o Default Encoding
o Base64 Encoding
o Legacy URL Encoding
o URL Encoding (RFC 3986)
Once all options are selected, press the Generate URL button.

Step 4: A new window will appear displaying the API URL. Copy the generated API URL. For
example:
[Link]

2
Step 5: Open the Postman tool by navigating to [Link]

Step 6: Click on the Sign In button and enter your Postman account credentials.

3
Step 7: In the Postman interface, select the Send an API request option and click on New
Request.

4
Step 8: In the new request window:
 Select the GET method from the dropdown.
 Paste the copied API URL in the request URL field.
Step 9: Click on the Send button to execute the API request.
Step 10: Postman will process the API request and display the response along with the status
code. The following are possible status codes and their meanings:
 200 - OK (Successful request execution)
 201 - Created (Resource successfully created)
 204 - No Content (Successful but no content returned)
 400 - Bad Request (Incorrect request format)
 401 - Unauthorized (Authentication required)
 404 - Not Found (Requested resource not available)
 405 - Method Not Allowed (Invalid HTTP method used)
If the response status is 200 OK, it confirms that the API request was executed successfully
without errors.

5
Output
{
"response_code": 0,
"results": [
{
"type": "multiple",
"difficulty": "medium",
"category": "Science: Computers",
"question": "Laserjet and inkjet printers are both examples of what type of printer?",
"correct_answer": "Non-impact printer",
"incorrect_answers": [
"Impact printer",
"Daisywheel printer",
"Dot matrix printer"
]
},
{
"type": "multiple",
"difficulty": "medium",
"category": "Science: Computers",
"question": "On which computer hardware device is the BIOS chip located?",
"correct_answer": "Motherboard",
"incorrect_answers": [
"Hard Disk Drive",
"Central Processing Unit",
"Graphics Processing Unit"
]
},
{
"type": "multiple",
"difficulty": "medium",
6
"category": "Science: Computers",
"question": ".rs is the top-level domain for what country?",
"correct_answer": "Serbia",
"incorrect_answers": [
"Romania",
"Russia",
"Rwanda"
]
},
{
"type": "multiple",
"difficulty": "medium",
"category": "Science: Computers",
"question": "How fast is USB 3.1 Gen 2 theoretically?",
"correct_answer": "10 Gb/s",
"incorrect_answers": [
"5 Gb/s",
"8 Gb/s",
"1 Gb/s"
]
},
{
"type": "multiple",
"difficulty": "medium",
"category": "Science: Computers",
"question": "What does AD stand for in relation to Windows Operating Systems? ",
"correct_answer": "Active Directory",
"incorrect_answers": [
"Alternative Drive",
"Automated Database",
"Active Department"
7
]
},
{
"type": "multiple",
"difficulty": "medium",
"category": "Science: Computers",
"question": "On which day did the World Wide Web go online?",
"correct_answer": "December 20, 1990",
"incorrect_answers": [
"December 17, 1996",
"November 12, 1990",
"November 24, 1995"
]
},
{
"type": "multiple",
"difficulty": "medium",
"category": "Science: Computers",
"question": "Which one of these is not an official development name for a Ubuntu
release?",
"correct_answer": "Mystic Mansion",
"incorrect_answers": [
"Trusty Tahr",
"Utopic Unicorn",
"Wily Werewolf"
]
},
{
"type": "multiple",
"difficulty": "medium",
"category": "Science: Computers",
8
"question": "What was the first Android version specifically optimized for tablets?",
"correct_answer": "Honeycomb",
"incorrect_answers": [
"Eclair",
"Froyo",
"Marshmellow"
]
},
{
"type": "multiple",
"difficulty": "medium",
"category": "Science: Computers",
"question": "What was the first commerically available computer processor?",
"correct_answer": "Intel 4004",
"incorrect_answers": [
"Intel 486SX",
"TMS 1000",
"AMD AM386"
]
},
{
"type": "multiple",
"difficulty": "medium",
"category": "Science: Computers",
"question": "All of the following programs are classified as raster graphics editors
EXCEPT:",
"correct_answer": "Inkscape",
"incorrect_answers": [
"[Link]",
"GIMP",
"Adobe Photoshop"
9
]
}
]
}

Result

The JSON Quiz was generated using OpenTDB API, and API testing was successfully
conducted using Postman. The response was validated based on HTTP status codes, confirming
successful request execution.

10

Common questions

Powered by AI

Choosing the 'Science: Computers' category in the OpenTDB API narrows the question scope to computer science-related topics, resulting in questions about hardware, software, and technological history. This allows users to generate quizzes tailored to specific knowledge areas, like understanding printer types or computing terms, making it useful for focused learning or assessments .

Specifying the correct HTTP method is crucial for successful API requests. For example, using GET method in Postman when interacting with the OpenTDB API fetches data from the server, such as quiz questions. An incorrect method, like POST, may result in a 405 Method Not Allowed error, indicating that the server does not support the requested method for the resource .

The JSON output indicates a successful API response with a response_code of 0, showing the request was fulfilled. It includes an array of questions with attributes like type, difficulty, category, and correct/incorrect answers, providing detailed data for the created quiz. This format helps users easily parse and utilize the quiz content generated by the API .

Selecting a difficulty level in the OpenTDB API allows the user to adjust the complexity of questions. Easy levels provide basic knowledge questions, whereas medium and hard levels present more challenging content that requires deeper understanding and reasoning, thus tailoring the quiz to the user's proficiency level .

The Open Trivia Database (OpenTDB) API offers different encoding methods such as Default Encoding, Base64 Encoding, Legacy URL Encoding, and URL Encoding (RFC 3986). These methods encode the data being sent through the API to ensure that special characters are correctly transmitted and interpreted, preventing errors or data loss during the API request .

To generate a JSON-based quiz using OpenTDB and test it with Postman, follow these steps: First, visit the OpenTDB website and select the API option. Specify parameters such as the number of questions, category, difficulty level, question type, and encoding option. After generating the API URL, open Postman, sign in, and create a new request using the GET method. Paste the API URL into the request field, send the request, and check the response to ensure it was successfully processed, indicated by a 200 OK status code .

HTTP status codes are significant in API testing as they indicate the result of the request. A 200 OK status confirms successful execution, while other codes like 400 indicate a Bad Request. Understanding these codes helps diagnose issues and verify whether the API interaction is functioning as expected. For instance, in testing the OpenTDB API with Postman, a 200 OK status confirms the quiz data was retrieved successfully .

Using the OpenTDB API and Postman can enhance educational tools by enabling the creation of custom quizzes aligned with specific academic standards or knowledge areas. This flexibility aids in preparing tests that suit varied educational needs or focus on learning engagement by diversifying question formats and difficulty levels within a structured API framework .

Verification involves checking the HTTP status code; a 200 OK signifies successful execution, meaning the data was correctly processed and retrieved. This validation is crucial since it assures the API functions as expected, and in educational contexts, ensures the integrity and reliability of quiz content generated from the API .

Multiple choice questions in the OpenTDB API provide a set of possible answers, including both correct and incorrect options, whereas true or false questions offer only two options, limiting complexity but simplifying user decisions. This distinction is important for users looking to customize quizzes based on desired difficulty or variety .

You might also like