View Categories

Creating and Managing Question Pools and Questions via API

This article provides a step-by-step guide for adding questions to the YouTestMe platform via API, ensuring an organized question structure for efficient management. It includes steps to create question pools, add individual questions, and link them to the pool.

Adding a Question Pool #

To create a new question pool, follow these steps:

    1. Access the Pools Section: Navigate to the Pools section and click on it.
    2. Initiate a New Pool: Select the POST /pools option.
    3. Enable Request Fields: Click Try it out to open the request fields.
    4. Enter Pool Details:
        1. parentPoolId: If this is a top-level pool, set to null. Otherwise, provide the ID of an existing pool.
        2. name: Specify a descriptive name (e.g., “AI Notes”).
        3. description: Briefly describe the purpose of this pool (e.g., “Pool for AI-related questions”).
        4. type: Indicate the type of pool, such as “TEST”.
  1. Execute the Request: Click Execute to create the pool. A 200 status code indicates success.

Example Request Body:

json
{
"parentPoolId": "null",
"name": "AI Notes",
"description": "Pool containing questions related to AI concepts.",
"type": "TEST"
}

If the request is successful, you will see a 200 status code in the response, indicating the question pool was added successfully.

Save the poolId for later use.

Adding Questions to the Pool #

After creating the pool, add questions as follows:

  1. Access the Questions Section: Navigate to Questions in the API documentation.
  2. Initiate a New Question: Select the POST /questions option.
  3. Enable Request Fields: Click Try it out.
  4. Enter Question Details:
    1. questionText: Write the question text.
    2. answers: List potential answers with their properties:
      1. answerText: Answer text.
      2. ordinalNumber: Display order of the answer.
      3. answerWeight: Weight for point calculation.
      4. answerCorrect: “Y” for correct, “N” for incorrect.
    3. questionType: Indicate type (e.g., “TFC” for True/False or “SNC” for single-choice).
    4. points, penalty, and duration: Set point value, penalty, and time limit.
  5. Execute the Request: Click Execute. A 201 status code confirms success.

Example Request Body:

json
{
"answers": [
{"answerText": "Option A", "ordinalNumber": 1, "answerWeight": 1, "answerCorrect": "Y"},
{"answerText": "Option B", "ordinalNumber": 2, "answerWeight": 1, "answerCorrect": "N"}
],
"duration": 5000,
"penalty": 2,
"points": 4,
"questionText": "What is AI?",
"questionType": "SNC",
"difficulty": 5
}

If the request is successful, you will see a 201 status code in the response, indicating the question was added successfully.

Save the questionId from the response.

Adding Questions to a Question Pool #

To associate questions with the created pool:

  1. Access Pool Questions Section: Navigate to Pool Questions in the API documentation.
  2. Initiate Linking: Select the POST /poolquestions option.
  3. Enable Request Fields: Click Try it out.
  4. Enter Link Details:
    1. poolId: ID of the question pool.
    2. questionId: ID of the question.
  5. Execute the Request: Click Execute. A 201 status code confirms successful linking.

If the request is successful, you will see a 201 status code in the response, indicating the question was added successfully.

Example Request Body:

json
{
"poolId": 12857,
"questionId": 65054
}

Demo Script #

A demonstration script illustrates the process of logging in, creating pools, adding questions, and linking them.

Powered by BetterDocs