Skip to content

Question Rest Service

Karthik Sankar Ram edited this page Mar 9, 2017 · 8 revisions

##Add new question to database

endpoint: "question"
Takes a question object as input and persists it to the database. Returns the saved object if successful. Fields are:
questionId: Should be set as null, will be filled when added to database.
format: The format ID for the question which is a number from 1 to 4 as follows:

  • 1 = Multiple Choice
  • 2 = Multiple Select
  • 3 = Drag and Drop
  • 4 = Code Snippet

questionCategory: It is a set of one or more category objects to which the question belongs eg: a question could be both Java and Data Structures. ###Category JSON categoryId: The unique identifier of the category in the database.
categoryName: The name of the category.

questionText: It is a string that is only the question, not the options.
questionTags: Not used currently, meant for future functionality. Set to null always.
option: A set of Option objects, each of them meant for one of the options of the question. For drag-drop and code snippet questions it must be set null. ###Option JSON optionId: The unique identifier of the option in the database.
optionText: The actual option.
correct: An integer set to 0 for incorrect options and 1 for correct options.

dragdrop: Used instead of "option" for drag-drop questions. Set null for all other questions. ###DragDrop JSON dragDropId: The unique identifier of the drag-drop option in the database.
dragDropText: The actual text of the drag-drop option.
correctOrder: The position in which the option should be for the correct solution. Indexing starts at 0.

snippetTemplates: Used instead of "option" for code snippet questions. Set null for all other questions.
###Snippet Template JSON snippetTemplateId: The unique identifier in the database.
fileType: A string specifying the type of file. Can be "c++", "java".
templateUrl: The name of the file with pre-written part of the code given to the test taker.
solutionUrl: The name of the solution file with working code.

EXAMPLE:
{
questionId = null,
format = 1,

Clone this wiki locally