jump

API Interface for Candidates’ Data Management

When you use OnlineExamMaker, we provide API for users to achieve Data Synchronization, here are the interfaces about candidates’ data management below.

1. Candidate information fields

The Interface to get candidatas’ fields:

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

(1) Data Interface

code=accesscode
  • code: the verification code unique to each account, string type, please contact us to get it.

(2)Return data

[
    {
        "sFid":1,// field id,int
        "label": "name", //field, string
        "isLoginField": false, //if shows false, means it is the ordinary field instead of login field
    }
]

(3)The data returned normally is as follows

[
    {
        "sFid": 1,
        "sLabel": "name"
    },
    {
        "sFid": 2,
        "sLabel": "gender"
    },
    {
        "sFid": 4,
        "sLabel": "phone number"
    },
    {
        "sFid": 5,
        "sLabel": "ID card"
    },
    {
        "sFid": 10,
        "sLabel": "password"
    },
    //all aboveare thedefault fields, may be more, please refer to the actual object obtained
    ...
]
  • If you want to add and modify the fields, please login the system and go to the candidate management.

2. Candidates Mangemanet

Candidate management interface provides functions to add, modify and delete candidate information.

(1)Interface to add candidates:

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

Parameter:

code=accesscode
students=[                      //candidates group,Each item object represents one candidate
    {                           //represents one candidate
        "gid": 11,              //id for the group
        "fields": [             //candidates information item
            {
                "sFid": 1,      // field id,int,can be got from the api of field,e.g.:"iphone number"id is 4, Name is 1
                "value":"Tom"  //field,e.g.: if sFid is 1,then it is name
            },
        ]
    },
]
  • code: the verification code unique to each account, string type, please contact us to get it.
  • Students indicates the candidate information to be added, and gid indicates the group to which the candidate is to be added. If it is multiple groups, please use a comma to separate string. Fields indicate candidates’ information items.

The return data when add successfully:

{
    "status": "ok",     //Successful return:ok, failed to return:error
    "success": [        //Successfully added data, each element is an object, sid indicates the candidate id, index indicates the order 
        {
            "sid":123,
            "index":1
        },
        {
            "sid":125,
            "index":2
        }
    ], 
    "fail": [3,4,5]     //fail means the students failed to add
}

(2)Interface to modify candidates information:

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

Parameter:

code=accesscode
stuInfo=[                      //candidates group,Each item object represents one candidate
    {                           //represents one candidate item
        "sid": 11,              //candates id,id and login value cannot be empty at the same time, one must be filled in
        "loginValue":"Tom"     //login field,id and login value cannot be empty at the same time, one must be filled in
        "fields": [             //candidates' information
            {
                "sFid": 1,      // ield id,int,can be got from the api of field,e.g.:"iphone number"id is 4, Name is 1
                "value":"Tony"  //field,e.g.: if sFid is 1,then it is name
            },
        ]
    },
]
  • code: the verification code unique to each account, string type, please contact us to get it.
  • stuInfo indicates the candidate information to be updated, sid indicates the candidate ID, loginValue indicates the candidate login field. Fields indicate candidates’ information items.

The return data when modify successfully:

{
    "status": "ok",     //Successfully return:ok, failed to return:error
    "success": [1,2],    //candidates'id or login field successfully added
    "fail": [3,4,5]     //candidates'id or login field fail to be added
}

(3)Interface to delete candidates:

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

Parameter:

code=accesscode
sids=[139, 392, 193, 932] //Candidate's ID list, choose one of id and login value, read the login value first
loginValues=["1000","10001"] //Candidate login value list, string array; choose one of id and login value, read login value first
  • *code:* the verification code unique to each account, string type, please contact us to get it.
  • sids represents the ID list of candidates to be deleted

The return data if delete successfully:

{
    "status": "ok",     //Successfully return:ok, failed to return:error
    "success": [1,2],    //candidates'id or login field successfully added
    "fail": [3,4,5]     //candidates'id or login field fail to be added
}

The return data if fail to delete:

{
    "status": "error",     //Successfully return:ok, failed to return:error
    "error": "Invalid sid"    //error means the items fail to delete
}

(4)Interface to move candidates to groups:

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

Parameter:

code=accesscode
mvStuInfo={
    "gids": [22,33], //If there are multiple fields in gids, it means adding candidates to these groups (PS: one candidate can exist in multiple groups at the same time)    
    "sids": [2213,3910] //Candidate's ID list, choose one of id and login value, read the login value first
    "loginValues":["Tom","Mary"] //Candidate login value, string array; choose one of id and login value, read login value first
    "action": "addto|moveto" //action,addto means to add to the group, one candidate can exist in multiple groups; moveto means to move to the group, one candidate only can exist in one group. If the action is moveto, the gids can only be one, if there are multiple gids, only the first one is selected
}
  • *code:* the verification code unique to each account, string type, please contact us to get it.
  • mvStuInfo represents the data information to be moved

The return data if succeed:

{
    "status": "ok",     //Successfully return:ok, failed to return:error
    "success": [1,2],    //candidates'id or login field successfully added
    "fail": [3,4,5]     //candidates'id or login field fail to be added
}

The return data if fail:

{
    "status": "error",     //Successfully return:ok, failed to return:error
    "error": "Invalid sid"    //error means the items fail to move

(5)Interface to get candidates’ information:

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

Parameter:

code=accesscode
sids=[13212,2382,392]
  • *code:* the verification code unique to each account, string type, please contact us to get it.
  • sids represents the ID list of candidates
  • can only check the information of up to 10 candidates at a time

The return data if succeed:

{
"status": "ok",     //Successfully return:ok, failed to return:error
"data": [
{
"sid": 3922, //ID of candidates
"loginValue":"Tom",//Candidate login field, if loginValues is requested, loginValue is returned
"fields":[
{
"sFid":1,
"label":"name",
"value": "Tom"
},
{
"sFid":13,
"label":"one group",
"value": "all groups"
}
],
"group": [
"gid": 123, //ID of groups
"title": "group name" //group name
]
},
{
"sid": 3925, //ID of candidate
"loginValue":"Tom",//Candidate login field, if loginValues is requested, loginValue is returned
"fields":[
{
"sFid":1,
"label":"name",
"value": "Tom"
},
{
"sFid":13,
"label":"one group",
"value": "all groups"
}
],
"group": [
"gid": 123, //ID of group
"title": "group name" //group name
]
}
]
}

The return data if fail:

{
"status": "error",     //Successfully return:ok, failed to return:error
"error": "Invalid sid"    //error means the items fail to get
}

(6)Interface to get candidate groups’ information:

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

Parameter:

code=accesscode
start=0
limit=30
  • code: the verification code unique to each account, string type, please contact us to get it.
  • start is used for paging display when the amount of data is large, indicating the data offset of the paging; defaulting it is 0, optional parameters.
  • limit is used for distribution display when the amount of data is large, set the number of data displayed per page; defaulting it is 30, optional parameters.

The return data if succeed:

{
{
"sid": "90068", //candidate id
"fields": [ //information item
{
"label": "name",
"sFid": "1",
"value": "candidate from api"
},
{
"label": "email",
"sFid": "3",
"value": "[email protected]"
},
{
"label": "password",
"sFid": "10",
"value": "123456"
}
]
},
{
"sid": "90067",
"fields": [
{
"label": "name",
"sFid": "1",
"value": "candidate from api"
},
{
"label": "email",
"sFid": "3",
"value": "[email protected]"
},
{
"label": "password",
"sFid": "10",
"value": "123456"
}
]
}
}

The return data if fail:

{
"status": "ok",
"message": "empty"
}