Create Question

This API is used to create Questions on the Sunbird-inQuiry Platform.

This API is used to create Question on the Sunbird-inQuiry Platform.

POST /question/v1/create

ā€¢ It points to inquiry-api-service (assessment service) - /question/v4/create ā€¢ It is mandatory to provide values for parameters marked with *. ā€¢ Mandatory fields cannot be null or empty. ā€¢ Question schema check here ā€¢ Appropriate fields need to be passed to work questions functionally well.

Headers

NameTypeDescription

Content-Type*

String

The Content-Type entity is the media type of the resource. It should beApplication/json

Authorization*

String

You require authorization to make use of the API. Raise a request to the administrator for the use of the API. You will receive the authorization key. Specify the key received, here. Set Bearer {{api_key}}

x-channel-id

String

Unique identification number associated with a root organization.

Request Body

NameTypeDescription

request*

object

request is the representation of the resource object for creating questions, which is an object of parameters that describes the question

{
  "id": "api.question.create",
  "ver": "3.0",
  "ts": "2021-02-02T19:28:24ZZ",
  "params": {
    "resmsgid": "8b75d237-1028-4e38-a94a-9ff4ca784d76",
    "msgid": null,
    "err": null,
    "status": "successful",
    "errmsg": null
  },
  "responseCode": "OK",
  "result": {
    "identifier": "do_11320791330308096015",
    "versionKey": "1612294104382"
  }
}

Sample Request

{
    "request": {
        "question": {
            "name": "string",
            "code": "string",
            "mimeType": "string",
            "primaryCategory": "string"
        }
    }

Request Schema

AttributeTypeDescriptionRequired

name

String

Represents the name of the question

Yes

code

String

Represents the unique code for the question

Yes

mimeType

String

Question mime type

Yes

primaryCategory

String

PrimaryCategory agains which question schema will be validated

Yes

Success Result Schema

AttributeTypeDescription

identifier

String

Unique Question Identifier

versionKey

String

Unique version key of Question

cURL:

curl --location -g --request POST '{{host}}/question/v1/create' \
--header 'Content-Type: application/json' \
--header 'X-Channel-Id: {{channel_id}}' \
--header 'Authorization: Bearer {{api_key}}' \
--data-raw '{
    "request": {
        "question": {
            "name": "Question 1",
            "code": "question.code",
            "mimeType": "application/vnd.sunbird.question",
            "primaryCategory": "Subjective Question"
        }
    }
}'

Full Request Example

Following is the complete request example of creating Multiple Choice Questions (MCQ).

This includes all the required fields to create a question object, as well as to work this question functionally some other fields were also added such as editorState, responseDeclaration, qType etc.

{
  "question": {
    "code": "f23d981a-e1db-2753-ebf3-f2a20c1578e3",
    "mimeType": "application/vnd.sunbird.question",
    "media": [],
    "editorState": {
      "options": [
        {
          "answer": true,
          "value": {
            "body": "<p>answer1</p>",
            "value": 0
          }
        },
        {
          "answer": false,
          "value": {
            "body": "<p>answer2</p>",
            "value": 1
          }
        },
        {
          "answer": false,
          "value": {
            "body": "<p>answer3</p>",
            "value": 2
          }
        },
        {
          "answer": false,
          "value": {
            "body": "<p>answer4</p>",
            "value": 3
          }
        }
      ],
      "question": "<p>question</p>"
    },
    "templateId": "mcq-vertical",
    "answer": "0",
    "bloomsLevel": "application",
    "maxScore": 1,
    "name": "1",
    "responseDeclaration": {
      "response1": {
        "maxScore": 1,
        "cardinality": "single",
        "type": "integer",
        "correctResponse": {
          "value": "0",
          "outcomes": {
            "SCORE": 1
          }
        },
        "mapping": []
      }
    },
    "interactionTypes": [
      "choice"
    ],
    "interactions": {
      "response1": {
        "type": "choice",
        "options": [
          {
            "label": "<p>answer1</p>",
            "value": 0
          },
          {
            "label": "<p>answer2</p>",
            "value": 1
          },
          {
            "label": "<p>answer3</p>",
            "value": 2
          },
          {
            "label": "<p>answer4</p>",
            "value": 3
          }
        ]
      }
    },
    "qType": "MCQ",
    "primaryCategory": "Multiple Choice Question",
    "body": "<div class='question-body' tabindex='-1'><div class='mcq-title' tabindex='0'><p>question</p></div><div data-choice-interaction='response1' class='mcq-vertical'></div></div>",
    "solutions": [],
    "creator": "N118",
    "createdBy": "b6640bfe-e294-4a54-8c75-589472324624",
    "board": "CBSE",
    "medium": [
      "English"
    ],
    "gradeLevel": [
      "Class 2"
    ],
    "subject": [
      "Mathematics"
    ],
    "author": "n11@yopmail.com",
    "channel": "01309282781705830427",
    "framework": "ekstep_ncert_k-12",
    "copyright": "NIT123",
    "audience": [
      "Student"
    ],
    "license": "CC BY 4.0",
    "programId": "18730310-5144-11ed-be8b-9962d8844469",
    "collectionId": "do_11365081180508160011559",
    "organisationId": "e7328d77-42a7-44c8-84f4-8cfea235f07d",
    "topic": [
      "Grouping and Counting"
    ],
    "isReviewModificationAllowed": false
  }
}

Last updated