GET https://lxapi.lexiangla.com/cgi-bin/v1/exams
参数 | 是否必须 | 默认值 | 说明 |
---|---|---|---|
sort | 否 | id | 排序参数,支持按考试的created_at排序 |
$Lxapi = new \Lexiangla\Openapi\Api(AppKey, AppSecret);
$response = $Lxapi->get('exams?per_page=2');
document
{
"data": [
{
"type": "exam",
"id": "d7ded3ce97e711e9af2f0a58ac1303b9",
"attributes": {
"title": "乐享第一场考试",
"started_at": "2019-06-04 15:34:00",
"ended_at": "2019-06-29 15:34:00",
"created_at": "2019-06-26 15:56:02",
"staffs_count": 3117,
"finished_staffs_count": 0,
"status": "running"
},
"links": {
"platform": "https://lexiangla.com/exams/d7ded3ce97e711e9af2f0a58ac1303b9"
},
"relationships": {
"owner": {
"data": {
"type": "staff",
"id": "ThreeZhang"
}
},
"team": {
"data": {
"type": "team",
"id": "a450d7bc01ed11eab1855254009b5a66"
}
}
}
},
{
"type": "exam",
"id": "865ff65493c811e9a1550a58ac130253",
"attributes": {
"title": "乐享第二场考试",
"started_at": "2019-06-21 10:00:00",
"ended_at": "2019-07-31 10:00:00",
"created_at": "2019-06-21 10:01:46",
"staffs_count": 3117,
"finished_staffs_count": 3,
"status": "running"
},
"links": {
"platform": "https://lexiangla.com/exams/865ff65493c811e9a1550a58ac130253"
},
"relationships": {
"owner": {
"data": {
"type": "staff",
"id": "FourLee"
}
}
}
}
],
"links": {
"first": "https://lxapi.lexiangla.com/cgi-bin/v1/exams?per_page=2&page=1",
"last": "https://lxapi.lexiangla.com/cgi-bin/v1/exams?per_page=2&page=176",
"prev": null,
"next": "https://lxapi.lexiangla.com/cgi-bin/v1/exams?per_page=2&page=2"
},
"meta": {
"current_page": 1,
"from": 1,
"last_page": 176,
"path": "https://lxapi.lexiangla.com/cgi-bin/v1/exams",
"per_page": 2,
"to": 2,
"total": 352
},
"included": [
{
"type": "staff",
"id": "ThreeZhang",
"attributes": {
"name": "张三",
"english_name": null
}
},
{
"type": "staff",
"id": "FourLee",
"attributes": {
"name": "李四",
"english_name": null
}
}
]
}
参数 | 说明 |
---|---|
title | 考试主题 |
started_at | 考试开始时间 |
ended_at | 考试截止时间 |
status | 考试状态(running:进行中;end:考试结束;published:待考) |
staffs_count | 应考人数 |
finished_staffs_count | 已考人数 |
created_at | 创建时间 |
GET https://lxapi.lexiangla.com/cgi-bin/v1/exams/{id}/staffs
参数 | 是否必须 | 默认值 | 说明 |
---|---|---|---|
id | 是 | 无 | 要获取考试答卷情况的考试ID |
per_page | 否 | 500 | 每页返回的数量,最大值2000 |
对于指定id参数,仅允许单个线程发起请求,请按分页信息逐页拉取。
$Lxapi = new \Lexiangla\Openapi\Api(AppKey, AppSecret);
$response = $Lxapi->get('exams/865ff65493c811e9a1550a58ac130253/staffs');
document
{
"data": [
{
"type": "staff",
"id": "ThreeZhang",
"attributes": {
"name": "张三",
"english_name": null,
"organization": "开发组\\乐享开发",
"event_status": "failed",
"review_status": "unreviewed",
"finish_at": "2019-06-21 16:54:14",
"result_score": 50,
"max_score_used_time": 20,
"avg_used_time": 20
}
},
{
"type": "staff",
"id": "TwoWang",
"attributes": {
"name": "王二",
"english_name": null,
"organization": "产品组",
"event_status": "failed",
"review_status": "unreviewed",
"finish_at": "2019-06-21 15:38:40",
"result_score": 20,
"max_score_used_time": 20,
"avg_used_time": 20
}
}
],
"links": {
"first": "https://lxapi.lexiangla.com/cgi-bin/v1/exams/865ff65493c811e9a1550a58ac130253/staffs?per_page=2&sort=-result_score&page=1",
"last": null,
"prev": null,
"next": "https://lxapi.lexiangla.com/cgi-bin/v1/exams/865ff65493c811e9a1550a58ac130253/staffs?per_page=2&sort=-result_score&page=2"
},
"meta": {
"current_page": 1,
"from": 1,
"path": "https://lxapi.lexiangla.com/cgi-bin/v1/exams/865ff65493c811e9a1550a58ac130253/staffs",
"per_page": 2,
"to": 2
}
}
分页信息meta
中不会返回last_page
(最后一页的页码)和total
(总数),links.last
也会固定为 null
需要拉取所有分页数据,可根据当前页返回data
是否空集,或者判断links.next
是否空,来决定是否继续拉取下一页数据
参数 | 说明 |
---|---|
name | 考生姓名 |
english_name | 考生英文名 |
organization | 考生部门 |
event_status | 考生答卷提交状态(waiting:待考;active:考试中;finished:已交卷;reexamining:重考中;passed:通过;failed:未通过) |
review_status | 考生答卷人工阅卷状态(reviewed:已阅卷;unreviewed:未阅卷) |
finish_at | 交卷时间 |
result_score | 答卷得分 |
max_score_used_time | 最高分用时,单位:秒数 |
avg_used_time | 平均用时,适用于可重考的考试,单位:秒数 |
{
"errors": [
{
"detail": "请求并发数超过限制"
}
]
}
GET https://lxapi.lexiangla.com/cgi-bin/v1/staffs/{id}/exams
参数 | 是否必须 | 默认值 | 说明 |
---|---|---|---|
sort | 否 | id | 排序参数,支持按交卷时间finish_at 、得分result_score 排序 |
id | 是 | 无 | 员工的企业微信ID |
$Lxapi = new \Lexiangla\Openapi\Api(AppKey, AppSecret);
$response = $Lxapi->get('staffs/ThreeZhang/exams');
document
{
"data": [
{
"type": "exam",
"id": "1b2b82a87dcb11e98df70a58ac1300a9",
"attributes": {
"title": "正常情况下--随机试卷30单选2分30多选3分",
"started_at": "2019-05-24 10:24:00",
"ended_at": "2019-06-02 10:24:00",
"created_at": "2019-05-24 10:24:49",
"status": "end",
"event_status": "waiting",
"review_status": "unreviewed",
"finish_at": "2019-05-28 11:21:11",
"result_score": 150,
"max_score_used_time": 20,
"avg_used_time": 20
},
"relationships": {
"team": {
"data": {
"type": "team",
"id": "a450d7bc01ed11eab1855254009b5a66"
}
}
},
"links": {
"platform": "https://lexiangla.com/exams/1b2b82a87dcb11e98df70a58ac1300a9"
}
},
{
"type": "exam",
"id": "2c7110827dcb11e989b70a58ac1300a9",
"attributes": {
"title": "可考10次固定试卷30单选2分30多选3分",
"started_at": "2019-05-24 10:24:00",
"ended_at": "2019-06-02 10:24:00",
"created_at": "2019-05-24 10:25:18",
"status": "end",
"event_status": "waiting",
"review_status": "unreviewed",
"finish_at": "2019-05-24 14:39:02",
"result_score": 150,
"max_score_used_time": 20,
"avg_used_time": 20
},
"links": {
"platform": "https://lexiangla.com/exams/2c7110827dcb11e989b70a58ac1300a9"
}
}
],
"links": {
"first": "https://lxapi.lexiangla.com/cgi-bin/v1/staffs/xxxx/exams?per_page=2&sort=-result_score&page=1",
"last": "https://lxapi.lexiangla.com/cgi-bin/v1/staffs/xxxx/exams?per_page=2&sort=-result_score&page=44",
"prev": null,
"next": "https://lxapi.lexiangla.com/cgi-bin/v1/staffs/xxxx/exams?per_page=2&sort=-result_score&page=2"
},
"meta": {
"current_page": 1,
"from": 1,
"last_page": 44,
"path": "https://lxapi.lexiangla.com/cgi-bin/v1/staffs/v_wwdzhang/exams",
"per_page": 2,
"to": 2,
"total": 87
}
}
参数 | 说明 |
---|---|
title | 考试主题 |
started_at | 考试开始时间 |
ended_at | 考试截止时间 |
status | 考试状态(running:进行中;end:考试结束;published:待考) |
created_at | 考试创建时间 |
event_status | 考生答卷提交状态(waiting:待考;active:考试中;finished:已交卷;reexamining:重考中;passed:通过;failed:未通过) |
review_status | 考生答卷人工阅卷状态(reviewed:已阅卷;unreviewed:未阅卷) |
finish_at | 交卷时间 |
result_score | 答卷得分 |
max_score_used_time | 最高分用时,单位:秒数 |
avg_used_time | 平均用时,适用于可重考的考试,单位:秒数 |
GET https://lxapi.lexiangla.com/cgi-bin/v1/question-libs
$Lxapi = new \Lexiangla\Openapi\Api(AppKey, AppSecret);
$response = $Lxapi->get('question-libs');
document
{
"data": [
{
"type": "question_lib",
"id": "574bbd76d88211ea968422ce1cbd4c3b",
"attributes": {
"team_id": "",
"is_shared": 1,
"name": "测试",
"created_at": "2020-08-07 15:48:11",
"updated_at": "2020-08-14 10:54:18",
"single_question_count": "10",
"multiple_question_count": "40",
"judgement_question_count": "0",
"fill_question_count": "10",
"open_question_count": "0"
},
"relationships": {
"owner": {
"data": {
"type": "staff",
"id": "ThreeZhang"
}
}
}
},
{
"type": "question_lib",
"id": "fa172aaed87d11ea8e8e622f20de686c",
"attributes": {
"team_id": "",
"is_shared": 1,
"name": "测试",
"created_at": "2020-08-07 15:16:56",
"updated_at": "2020-08-15 20:35:58",
"single_question_count": "10",
"multiple_question_count": "40",
"judgement_question_count": "0",
"fill_question_count": "10",
"open_question_count": "0"
},
"relationships": {
"owner": {
"data": {
"type": "staff",
"id": "ThreeZhang"
}
}
}
},
],
"links": {
"first": "https://lxapi.lexiangla.com/cgi-bin/v1/question-libs?page=1",
"last": "https://lxapi.lexiangla.com/cgi-bin/v1/question-libs?page=18",
"prev": null,
"next": "https://lxapi.lexiangla.com/cgi-bin/v1/question-libs?page=2"
},
"meta": {
"current_page": 1,
"from": 1,
"last_page": 18,
"path": "https://lxapi.lexiangla.com/cgi-bin/v1/question-libs",
"per_page": 20,
"to": 20,
"total": 360
},
"included": [
{
"type": "staff",
"id": "ThreeZhang",
"attributes": {
"name": "张三",
"english_name": null
}
},
{
"type": "staff",
"id": "ThreeZhang",
"attributes": {
"name": "张三",
"english_name": null
}
},
{
"type": "team",
"id": "c28d32cc753811e889bb5254002b6735",
"attributes": {
"code": "k100240",
"name": "测试",
"type": 2,
"signature": "s",
"is_secret": 0,
"category_id": "d9b488f41fd911ea90a95254009b5a66"
}
},
{
"type": "team",
"id": "c3395228b4f211e9a1e30a58ac1300be",
"attributes": {
"code": "k100461",
"name": "测试",
"type": 2,
"signature": "123",
"is_secret": 0,
"category_id": "d9b488f41fd911ea90a95254009b5a66"
}
}
]
}
参数 | 说明 |
---|---|
name | 题库名称 |
team_id | null表示来源考试管理后台,否则展示team_id,表示来源于某K吧 |
is_shared | true/false:表示使用权限是否私密 |
owner | 创建者 |
created_at | 创建时间 |
update_at | 更新时间 |
single_question_count | 单选题数 |
multiple_question_count | 多选题数 |
judgement_question_count | 判断题数 |
fill_question_count | 填空题数 |
open_question_count | 问答题数 |
GET https://lxapi.lexiangla.com/cgi-bin/v1/question-libs/{id}
$Lxapi = new \Lexiangla\Openapi\Api(AppKey, AppSecret);
$response = $Lxapi->get('question-libs/fa172aaed87d11ea8e8e622f20de686c');
document
{
"data": {
"type": "question_lib",
"id": "fa172aaed87d11ea8e8e622f20de686c",
"attributes": {
"team_id": "",
"is_shared": 1,
"name": "10单选30多选10判断5填空5问答",
"created_at": "2020-08-07 15:16:56",
"updated_at": "2020-08-15 20:35:58"
}
}
}
参数 | 说明 |
---|---|
name | 题库名称 |
team_id | null表示来源考试管理后台,否则展示team_id,表示来源于某K吧 |
is_shared | true/false:表示使用权限是否私密 |
owner | 创建者 |
created_at | 创建时间 |
update_at | 更新时间 |
GET https://lxapi.lexiangla.com/cgi-bin/v1/question-libs/{id}/questions
$Lxapi = new \Lexiangla\Openapi\Api(AppKey, AppSecret);
$response = $Lxapi->get('question-libs/fa172aaed87d11ea8e8e622f20de686c/questions');
参数 | 是否必须 | 默认值 | 说明 |
---|---|---|---|
id | 是 | 无 | 题库id |
document
{
"data": [{
"type": "exam_question",
"id": "e1c0e9fae74a11eaa4163ab4e0e8c7b9",
"attributes": {
"title": "测试",
"question_content": "{\"choices\":null,\"title\":\"测试\"}",
"answer_content": "{\"expect\":\"\",\"keyword\":\"性能;复用;难度\",\"analysis\":\"\"}",
"type": 5
},
"relationships": {
"question_lib": {
"data": {
"type": "questionlib",
"id": "c95fa9b4e74a11eaa38a3ab4e0e8c7b9"
}
}
}
}],
"links": {
"first": "https://lxapi.lexiangla.com/cgi-bin/v1/question-libs/c95fa9b4e74a11eaa38a3ab4e0e8c7b9/questions?page=1",
"last": "https://lxapi.lexiangla.com/cgi-bin/v1/question-libs/c95fa9b4e74a11eaa38a3ab4e0e8c7b9/questions?page=1",
"prev": null,
"next": null
},
"meta": {
"current_page": 1,
"from": 1,
"last_page": 1,
"path": "https://lxapi.lexiangla.com/cgi-bin/v1/question-libs/c95fa9b4e74a11eaa38a3ab4e0e8c7b9/questions",
"per_page": 20,
"to": 1,
"total": 1
}
}}
}
参数 | 说明 |
---|---|
question_content | 问题内容json,title(题干)、choice(填空题、问答题为null) |
answer_content | 答案内容json,expect(正确答案,问答题不返回)、keyword(仅问答题有keyword)、analysis(没有则为null) |