API for Exam Scores and Reports¶
OnlineExamMaker enables users get exam scores, exam status, students answers and other information via API.
Note: OnlineExamMaker API is only available for Premium users, if you want to request data from OnlineExamMaker API, please upgrade your account to Premium member.
1. Get exam score of a single candidate or all candidates¶
Get exam score of a single candidate or all candidates:¶
GET https://api.onlineexammaker.com/api/v1/student/queryresults
Parameter:¶
code=authorization code&time=current timestamp&eid=exam id&loginValues=exam verification information&start=0&limit=30
Parameter description:¶
- code: Verification code is unique to each OnlineExamMaker account, Premium users can get it in "System Settings" -> "API & SSO Settings" in OnlineExamMaker dashoboard. (Related tutorial: How to get verification code for API?)
- time: Current timestamp, for example: 1638768935.
- start: Paging parameter.
- limit: The quantity of queries. The maximum number of queries is 100.
- loginValues: If you need to query the test records of a single candidate, you must use it with eid.
-
eid: If you need to query the test records of a single candidate, you need to use it with loginValues.
-
Authorization: Please put Token in the request header, you can view the sample code for details. In simple terms: we concatenate the current timestamp and your code, and encrypt them with MD5.
If the operation is successful, the return value is:¶
{
"data":[
{
"viewResult":"https://api.onlineexammaker.com/transgetresult?tid=xxx\u0026token=xxx", //Test paper details link, the symbol '&' should be replaced with '\u0026'
"score":"2",//Score
"passed":"0",//Pass the exam or not
"status":"1",
"startTime":"1639647217",//Exam start tiem
"endTime":"1639647236",//Exam end tiem
"sid":"170597",
"loginValue":"n11",//login field
"name":"n11",//candidate name
"eid":"107264"//exam id
},
{
"viewResult":"https://api.onlineexammaker.com/transgetresult?tid=xxx\u0026token=xxx",
"score":"1",
"passed":"0",
"status":"1",
"startTime":"1639647122",
"endTime":"1639647132",
"sid":"170597",
"loginValue":"n11",
"name":"n11",
"eid":"107264"
}
],
"status":"ok",
"total":1877
}
If the operation fails, the return value is:¶
Interface usage examples:¶
package main
import (
"crypto/md5"
"fmt"
"io/ioutil"
"log"
"net/http"
"os"
"strconv"
"time"
)
const (
Code = "xxx"
)
func main() {
host := "https://api.onlineexammaker.com"
resource := "/api/v1/student/queryresults"
client := &http.Client{}
fullPath := host + resource
req, _ := http.NewRequest(http.MethodGet, fullPath, nil)
time64 := time.Now().UTC().Unix()
ParseToken := fmt.Sprintf("%x", md5.Sum([]byte(strconv.FormatInt(time64, 10)+Code)))
req.Header.Set("Authorization", ParseToken)
q := req.URL.Query()
q.Add("code", Code)
q.Add("time", strconv.Itoa(int(time64)))
q.Add("start", "0")
q.Add("limit", "2")
// ↑↑Get all candidates' exam data↑↑
// ↓↓Get the exam taken record of a single candidate↓↓
// q.Add("loginValues", "n11")
// q.Add("eid", "107264")
q.Add("time", strconv.Itoa(int(time64)))
req.URL.RawQuery = q.Encode()
resp, err := client.Do(req)
if err != nil {
log.Println(err)
return
}
defer resp.Body.Close()
b, err := ioutil.ReadAll(resp.Body)
if err != nil {
log.Println(err)
return
}
// fmt.Println(string(b))
f, _ := os.OpenFile("test.txt", os.O_RDWR|os.O_CREATE|os.O_TRUNC, 0644)
f.Write(b)
}
2. Get the list of exams¶
Get the list of exams¶
GET https://api.onlineexammaker.com/api/v1/student/getexams
Parameter:¶
code=authorization code&time=current timestamp&sid=student id&gid=candidate id&catid=exam category id&keyword=search keyword&userId=user id&start=0&limit=30
Parameter description:¶
- code: Verification code is unique to each OnlineExamMaker account, Premium users can get it in "System Settings" -> "API & SSO Settings" in OnlineExamMaker dashoboard. (Related tutorial: How to get verification code for API?)
- time: Current timestamp, for example: 1638768935.
- start: Paging parameter.
- limit: The quantity of queries. The maximum number of queries is 100.
- sid: Candidate id.
- gid: Candidate group id.
- keyword: Exam title keyword.
- userId: User id.
If the operation is successful, the return value is:¶
{
"data": [
{
"title": "Online English Vocabulary Test on OnlineExamMaker.com",
"description": "How many words do you know? Get an estimate in minutes with this simple test.",
"status": "Permanent",
"attempts": "Unlimited",
"available": 1,
"eid": "3504",
"category": "Lauguage Learning",
"stuTimes": 0,
"totalTimes": 0,
"createTime": "1691473157",
"img": "https://fs.onlineexammaker.com/papercover/company/company_1.png",
"url": "http://10.0.50.159:9874/doexam/aWoeKL89V5.html",
"total_score": 1,
"pass_score": 0.6,
"starttime": 1691473140,
"endtime": 1691473140
},
{
"title": "English Grammar Level Test on OnlineExamMaker.com",
"description": "Take our free English grammar level test and find your English level. ",
"status": "Permanent",
"attempts": "Unlimited",
"available": 1,
"eid": "3503",
"category": "Lauguage Learning",
"stuTimes": 0,
"totalTimes": 1,
"createTime": "1688708778",
"img": "https://fs.onlineexammaker.com/papercover/teacher/teacher_4.png",
"url": "http://10.0.50.159:9874/doexam/EDobq5Lr78.html",
"total_score": -5,
"pass_score": -3,
"starttime": 1688709240,
"endtime": 1688709240
}
],
"status": "ok",
"total": 3
}
If the operation fails, the return value is:¶
Interface usage examples:¶
package main
import (
"crypto/md5"
"fmt"
"io/ioutil"
"log"
"net/http"
"os"
"strconv"
"time"
)
const (
Code = "xxx"
)
func main() {
host := "https://api.onlineexammaker.com"
resource := "/api/v1/student/getexams"
client := &http.Client{}
fullPath := host + resource
req, _ := http.NewRequest(http.MethodGet, fullPath, nil)
time64 := time.Now().UTC().Unix()
ParseToken := fmt.Sprintf("%x", md5.Sum([]byte(strconv.FormatInt(time64, 10)+Code)))
req.Header.Set("Authorization", ParseToken)
q := req.URL.Query()
q.Add("code", Code)
q.Add("time", strconv.Itoa(int(time64)))
q.Add("sid", "1")
q.Add("eid", "2")
q.Add("gid", "3")
q.Add("catid", "4")
q.Add("keyword", "5")
q.Add("userId", "6")
q.Add("start", "0")
q.Add("limit", "30")
req.URL.RawQuery = q.Encode()
resp, err := client.Do(req)
if err != nil {
log.Println(err)
return
}
defer resp.Body.Close()
b, err := ioutil.ReadAll(resp.Body)
if err != nil {
log.Println(err)
return
}
// fmt.Println(string(b))
f, _ := os.OpenFile("test.txt", os.O_RDWR|os.O_CREATE|os.O_TRUNC, 0644)
f.Write(b)
}