Question Rest Service - 1610oct24java/AssociateEvaluationSystem GitHub Wiki
##Add new question to database
endpoint: "question", POST method
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",
questionCategory = { {categoryId = null, categoryName = "Java"} },
questionText = "What is Inheritance?",
questionTags = null,
option = {
{optionId = null,
optionText = "The ability for one class to pass on select properties and behaviors to a subclass which extends it.",
correct = "1" },
{optionId = null,
optionText = "When two methods in the same class have the same name, but are differentiated by the parameters which are passed in.",
correct = "0" }
},
dragdrop = null,
snippetTemplates = null
}
##Retrieve Single Question from the Database
Currently not in use
##Deleting Drag-Drop Option by ID
endpoint: "question/deleteDragDrop/{dragDropId}"
Takes in the id of the option to be deleted from the question and modifies the question in the database.
EXAMPLE: http://localhost:8090/aes/question/deleteDragDrop/34
##Retrieve All Questions from the Database
endpoint: "question", GET method
When accessed with no arguments, we receive a List of all the questions as Question objects
EXAMPLE: http://localhost:8090/aes/question/
##Retrieve Questions by Format
endpoint: "question/{format}", GET method
Takes the format JSON and returns the List of all questions of that format.
EXAMPLE: http://localhost:8090/aes/question/{formatId = "1", formatName = "Multiple Choice"}