❔
Sunbird inQuiry
  • LEARN
    • Overview
    • Capabilities
    • Components
    • Technical Architecture
    • Product & Developer Guide
      • Quick Starter Guide
        • inQuiry Components
          • Editor
          • Player
          • inQuiry Service
      • Question & Question Set Editor
        • Architecture
        • Features
        • Configuration
        • Source Code
        • APIs
        • FAQ's
      • Question & Question Set Service
        • Architecture
        • Features
        • Schema
          • Question Schema
          • QuestionSet Schema
        • APIs
          • V1
            • Question API's
              • Create Question
              • Read Question
              • Read Private Question
              • Update Question
              • Submit for Review Question
              • Publish Question
              • Retire Question
              • Question List
              • Import Question
              • Copy Question
              • Reject Question
            • QuestionSet API's
              • Create QuestionSet
              • Update QuestionSet
              • Read QuestionSet
              • Read Private QuestionSet
              • Review QuestionSet
              • Reject QuestionSet
              • Publish QuestionSet
              • Retire QuestionSet
              • Update Hierarchy QuestionSet
              • Read QuestionSet Hierarchy
              • Import QuestionSet
              • Copy QuestionSet
          • V2
            • Question API's
              • Create Question
              • Read Question
              • Read Private Question
              • Update Question
              • Submit for Review Question
              • Reject Question
              • Publish Question
              • Copy Question
              • Import Question
              • Question List
              • Retire Question
            • QuestionSet API's
              • Create QuestionSet
              • Read QuestionSet
              • Read Private QuestionSet
              • Update QuestionSet
              • Review QuestionSet
              • Reject QuestionSet
              • Publish QuestionSet
              • Update Hierarchy QuestionSet
              • Read QuestionSet Hierarchy
              • Import QuestionSet
              • Copy QuestionSet
              • Retire QuestionSet
        • Configuration
        • Source Code
        • FAQs
      • Question Set Player
        • Architecture
        • Configuration
        • Source Code
        • APIs
        • FAQ's
      • Analytics
      • Code Coverage Stats
    • 🚀Product Roadmap
  • ENGAGE
    • Discuss
  • Use
    • Overview
    • Developer Installation
      • Question & Question Set Service
        • Installation
        • Configuration
      • Question Set Editor
        • Installation
          • Object Category Definition
          • Sample Form Configuration
      • Question set Player
        • Installation
    • Release Plan & Calendar
      • Release calendar 5.2.0, 5.3.0, 5.4.0, 5.5.0, 5.6.0
      • Release calendar 5.7.0, 6.0.0,6.1.0 and 6.2.0
    • Release notes
      • inQuiry - Release v8.0.0 (Ongoing)
      • inQuiry - Release v7.0.0 (Latest)
      • inQuiry - Release v6.2.0
      • inQuiry - Release v6.1.0
      • inQuiry - Release v6.0.0
      • inQuiry - Release v5.7.0
      • inQuiry - Release v5.6.0
      • inQuiry - Release v5.5.0
      • inQuiry - Release v5.4.0
      • inQuiry - Release v5.3.0
      • inQuiry - Release v5.2.0
      • inQuiry - Release v5.1.0
      • inQuiry - Release v5.0.0
      • inQuiry - Release V 4.10.0
      • inQuiry - Release V 4.9.0
      • inQuiry - Release V 4.8.0
      • inQuiry - Release V 4.7.0
    • Deprecations
      • Release-5.6.0 (upcoming)
      • Release-5.5.0
    • Learn More
      • Dependencies
      • Delete User Functionality
        • User PII Cleanup
        • Asset Ownership Transfer
  • Guidelines or Best practices
    • Testing QA guidelines
    • Developer coding guidelines
  • Archived
    • Use Cases
    • Components
    • Server Installation
    • Capabilities
Powered by GitBook
On this page

Was this helpful?

Edit on GitHub
  1. LEARN
  2. Product & Developer Guide
  3. Question & Question Set Service
  4. APIs
  5. V1
  6. QuestionSet API's

Update Hierarchy QuestionSet

This API is used to update the existing question set on the Sunbird-inQuiry Platform.

This API is used to update the existing question set on the Sunbird-inQuiry Platform.

PATCH /hierarchy/update

• /hierarchy/update/ endpoint executes the "Update Hierarchy QuestionSet" request based on parameters provided as metadata in the request body. •This API is used to add new children and update the existing children or update a hierarchical structure of the question set. • It points to inquiry-api-service (assessment service) - /questionset/v4/hierarchy/update • It is mandatory to provide values for parameters marked with * • Mandatory fields cannot be null or empty.

Headers

Name
Type
Description

Content-Type*

String

The Content Type entity is the media type of the resource.Possible media types can be: Application/json

Authorization*

String

All question APIs require authorization for use. Specify the authorization key received from the administrator when placing the request for use of the API. Set Bearer {{api_key}}

x-channel-id

String

Unique identification number associated with a root organization.

Request Body

Name
Type
Description

request*

Object

It contains metadata and a hierarchy of the question set to be updated.

{
  "id": "api.questionset.hierarchy.update",
  "ver": "3.0",
  "ts": "2021-02-03T13:06:12ZZ",
  "params": {
    "resmsgid": "221f9cdb-c220-4d3f-a579-4e7b82facf89",
    "msgid": null,
    "err": null,
    "status": "successful",
    "errmsg": null
  },
  "responseCode": "OK",
  "result": {
    "identifier": "do_113208431570984960123",
    "identifiers": {
      "section-1": "do_113208433229889536126",
      "question-1": "do_113208433229873152124"
    }
  }
}
{
  "id": "api.questionset.hierarchy.update",
  "ver": "3.0",
  "ts": "2021-02-03T13:11:14ZZ",
  "params": {
    "resmsgid": "04e218fc-76bc-4fd3-b98d-5ed947a30b8b",
    "msgid": null,
    "err": "ERR_QS_UPDATE_HIERARCHY",
    "status": "failed",
    "errmsg": "Question cannot have children in hierarchy"
  },
  "responseCode": "CLIENT_ERROR",
  "result": {
    "messages": null
  }
}
{
  "id": "api.questionset.hierarchy.update",
  "ver": "3.0",
  "ts": "2021-02-03T13:27:12ZZ",
  "params": {
    "resmsgid": "0fbe77de-a612-4406-bcd2-a63de5b29b6d",
    "msgid": null,
    "err": "NOT_FOUND",
    "status": "failed",
    "errmsg": "Error! Node(s) doesn't Exists. | [Invalid Node Id.]: do_1132084315709849601231"
  },
  "responseCode": "RESOURCE_NOT_FOUND",
  "result": {
    "messages": null
  }
}
{
  "result": {},
  "id": "string",
  "ver": "string",
  "ts": "string",
  "params": {
    "resmsgid": "string",
    "msgid": "string",
    "err": "string",
    "status": "string",
    "errmsg": "string"
  },
  "responseCode": "string"
}

Request Sample

{
  "request": {
    "data": {
      "nodesModified": {
        "do_213683948732522496129": {
          "root": true,
          "objectType": "QuestionSet",
          "metadata": {
            "appIcon": "https://sunbirddevbbpublic.blob.core.windows.net/sunbird-content-staging/content/assets/do_2136839488184156161188/istockphoto-184276818-612x612.jpg",
            "name": "QuestionSet-Draft5",
            "description": "test",
            "instructions": {
              "default": "<p>test</p>"
            },
            "primaryCategory": "Practice Question Set",
            "additionalCategories": [

            ],
            "board": "CBSE",
            "medium": [
              "English"
            ],
            "gradeLevel": [
              "Class 4"
            ],
            "subject": [
              "Math"
            ],
            "audience": [
              "Student"
            ],
            "showTimer": "No",
            "requiresSubmit": "No",
            "author": "N11",
            "copyright": "NIT123",
            "license": "CC BY 4.0",
            "attributions": [

            ],
            "maxScore": 1
          },
          "isNew": false
        },
        "do_213683949640613888132": {
          "root": false,
          "objectType": "QuestionSet",
          "metadata": {
            "name": "Section-101",
            "description": "test",
            "shuffle": true,
            "showFeedback": "Yes",
            "showSolutions": "Yes",
            "primaryCategory": "Practice Question Set",
            "attributions": [

            ]
          },
          "isNew": false
        }
      },
      "hierarchy": {
        "do_213683948732522496129": {
          "name": "QuestionSet-Draft5",
          "children": [
            "do_213683949640613888132"
          ],
          "root": true
        },
        "do_213683949640613888132": {
          "name": "Section-101",
          "children": [
            "do_21368395028149862413"
          ],
          "root": false
        },
        "do_21368395028149862413": {
          "name": "sub",
          "children": [

          ],
          "root": false
        }
      },
      "lastUpdatedBy": "5a587cc1-e018-4859-a0a8-e842650b9d64"
    }
  }
}

Request Shema

Attribute
Type
Description
Required

nodesModified

Object

objects details to be created or updated

Yes

hierarchy

Object

objects hierarchy details

Yes

Success result schema

Attribute
Type
Description

identidier

String

Unique Question identifier

identifiers

String

Object mapping i.e. created or updated

cURL

curl --location -g --request PATCH '{{host}}/questionset/v1/hierarchy/update' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer {{api_key}}' \
--data-raw '{
  "request": {
    "data": {
      "nodesModified": {
        "{questionSet-id}}": {
          "metadata": {
            "code": "updated_code_of_root"
          },
          "root": true,
          "isNew": false
        },
        "section-1": {
          "metadata": {
            "code": "section-1",
            "name": "Section-1",
            "description": "Section-1",
            "mimeType": "application/vnd.sunbird.questionset",
            "visibility":"Parent",
            "primaryCategory": "Practice Question Set"
          },
          "root": false,
          "isNew": true
        },
        "question-1": {
          "metadata": {
            "code": "question-1",
            "name": "Question-1",
            "description": "Question-1",
            "mimeType": "application/vnd.sunbird.question",
            "visibility": "Parent",
            "primaryCategory": "Multiple Choice Question"
          },
          "root": false,
          "isNew": true
        }
      },
      "hierarchy": {
        "{{questionSet-id}}": {
          "children": [
            "section-1"
          ],
          "root": true
        },
        "section-1": {
          "children": [
          "question-1"
          ],
          "root": false
        }
      }
    }
  }
}'

Complete example

The following request is for updating the existing question set. Here, a new question (MCQ) is added to one of the sections of the question set.

{
  "request": {
    "data": {
      "nodesModified": {
        "75da35b2-3359-4f7c-82e3-7d40d13acd96": {
          "metadata": {
            "mimeType": "application/vnd.sunbird.question",
            "media": [
            ],
            "editorState": {
              "options": [
                {
                  "answer": true,
                  "value": {
                    "body": "<p>Yellow</p>",
                    "value": 0
                  }
                },
                {
                  "answer": false,
                  "value": {
                    "body": "<p>Red</p>",
                    "value": 1
                  }
                },
                {
                  "answer": false,
                  "value": {
                    "body": "<p>Orange</p>",
                    "value": 2
                  }
                }
              ],
              "question": "<p>What is the color of lemon?</p>"
            },
            "templateId": "mcq-vertical",
            "answer": "0",
            "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>Yellow</p>",
                    "value": 0
                  },
                  {
                    "label": "<p>Red</p>",
                    "value": 1
                  },
                  {
                    "label": "<p>Orange</p>",
                    "value": 2
                  }
                ]
              },
              "validation": {
                "required": "Yes"
              }
            },
            "qType": "MCQ",
            "primaryCategory": "Multiple Choice Question",
            "body": "<div class='question-body' tabindex='-1'><div class='mcq-title' tabindex='0'><p>What is the color of lemon?</p></div><div data-choice-interaction='response1' class='mcq-vertical'></div></div>",
            "solutions": [

            ],
            "createdBy": "5a587cc1-e018-4859-a0a8-e842650b9d64",
            "board": "CBSE",
            "medium": [
              "English"
            ],
            "gradeLevel": [
              "Class 4"
            ],
            "subject": [
              "Geography"
            ],
            "author": "N11",
            "channel": "01309282781705830427",
            "framework": "inquiry_k-12",
            "copyright": "NIT123",
            "audience": [
              "Administrator"
            ],
            "license": "CC BY 4.0"
          },
          "objectType": "Question",
          "root": false,
          "isNew": true
        }
      },
      "hierarchy": {
        "do_213703055622299648111": {
          "name": "Test QuestionSet",
          "children": [
            "do_213703056367386624112"
          ],
          "root": true
        },
        "do_213703056367386624112": {
          "name": "Section 1",
          "children": [
            "75da35b2-3359-4f7c-82e3-7d40d13acd96"
          ],
          "root": false
        }
      }
    }
  }
}

PreviousRetire QuestionSetNextRead QuestionSet Hierarchy

Last updated 2 years ago

Was this helpful?