# API Interface for Candidate Group Management¶

When use Online Exam Maker, we provide API for users to achieve Data Synchronization, here are the interfaces for organization management below.

Synchronizing the datum of candidates can conveniently exchange the candidates’ datum between the system, and avoid the error that may appear manually. Automatic synchronization is timely and quick, which can synchronize the information of the candidates and the organizations they belong to.

Category Management

Online Exam Maker manages the candidates by category, which can be understood as the class, the department. Online Exam Maker supports infinite hierarchical tree group management, as shown in the figure below

The interface to add category of candidates

POST https://www.onlineexammaker.com/index.php?option=com_exams&task=api.newGroup&format=raw


Parameter

code=access code&title=category title&parentGid=0

• code: A unique verification code for each account, String type, a value that can be obtained by associating with Online Exam Maker
• title: the title of category
• parentGid: The ID of the parent category, 0 means the root category is created, and greater than 0 means a subcategory under that category is created

Return if the operation is successful

{
"status": "ok", //ok means successful， error means failed
"gid": 1931 //gid means the ID of the new category
}


Return if the operation fails

{ “status”: “error”, “error”: “the title cannot be empty” //Error message that occurred while creating }

(2)Category Editing

The interface to edit the name of an existing category

POST https://www.onlineexammaker.com/index.php?option=com_exams&task=api.renameGroup&format=raw


Parameter

code=access code&title=category title&gid=0

• code: A unique verification code for each account, String type, a value that can be obtained by associating with Online Exam Maker
• title: the new title of category
• gid: alter the ID of category, it need to be greater than 0

Return if the operation is successful

{ “status”: “ok”, //ok means successful， error means failed “gid”: 1931, //gid means the ID of the category “oldTitle”: “Math 1” //means the original title }

Return if the operation fails

{
"status": "error",
"error": "the title cannot be empty" //Error message that occurred while creating
}


(3)Category Deleting

The interface to delete a group

POST https://www.onlineexammaker.com/index.php?option=com_exams&task=api.delGroup&format=raw


Parameter

code=access code&gid=231

• code: A unique verification code for each account, String type, a value that can be obtained by associating with Online Exam Maker
• gid: delete the ID of category, it need to be greater than 0

Return if the operation is successful

{
"status": "ok", //ok means successful， error means failed
}


Return if the operation fails

{
"status": "error",
"error": "incorrect ID of the category, Please confirm whether you have permission to modify the category's information" //Error message that occurred while creating
}


(4)Category Transfer

The interface to move a category to the subgroup of another category

POST https://www.onlineexammaker.com/index.php?option=com_exams&task=api.mvGroup&format=raw


Parameter

code=access code&gid=112&mvToGid=23

• code: A unique verification code for each account, String type, a value that can be obtained by associating with Online Exam Maker
• gid: the ID of category to move to, it need to be greater than 0
• mvToGid: The ID of the category to move to

Return if the operation is successful

{
"status": "ok", //ok means successful， error means failed
}


It indicates that a gid has been moved to mvToGid and becomes a subgroup of it

Return if the operation fails

{
"status": "error",
"error": "incorrect ID of the category, Please confirm whether you have permission to modify the category's information" //Error message that occurred while creating
}


(5)Category List Acquisition

The interface to return all subgroup information under a group (or all groups)

GET https://www.onlineexammaker.com/index.php?option=com_exams&task=api.lsGroups&format=raw


Parameter

code=access code&gid=112

• code: A unique verification code for each account, String type, a value that can be obtained by associating with Online Exam Maker
• gid: an optional parameter. If this parameter is set, information for all subgroups under that category is listed. If the gid is 0 or not set, the category data of all root paths will be listed

Return if the operation is successful

{
"status": "ok", //ok means successful， error means failed，
"data": [
{
"gid": 1312, //category ID
"title": "category title", //title of the category
},
{
"gid": 1332, //category ID
"title": "category title", //title of the category
}
...
]
}


Return if the operation fails

{
"status": "error",
"error": "incorrect ID of the category, Please confirm whether you have permission to modify the category's information" //Error message that occurred while creating
}