# 考试

# 获取已发布的考试列表

# 接口调用说明:

GET https://lxapi.lexiangla.com/cgi-bin/v1/exams

# 参数说明:

支持分页参数和排序:(通用说明?

支持时间范围过滤

参数 是否必须 默认值 说明
sort id 排序参数,created_at升序,-created_at表示降序
team_id K吧id
app_source_type 考试的应用来源,为空或不传获取的是全部,exam:来自考试应用,roadmap:来自项目
filter[started_at][since] 考试的开始时间:开始日期(包含)。格式:2023-03-08

当时间格式为:2023-03-08 12:00:01 时间筛选从此刻开始(包含前s)
filter[started_at][until] 考试的开始时间:结束日期(不包含)。格式:2023-03-09

当时间格式为:2023-03-09 12:00:05 时间筛选从此刻结束(不包含前s)
filter[ended_at][since] 考试的截止时间:开始日期(包含)。格式:2023-03-08

当时间格式为:2023-03-08 12:00:01 时间筛选从此刻开始(包含前s)
filter[ended_at][until] 考试的截止时间:结束日期(不包含)。格式:2023-03-09

当时间格式为:2023-03-09 12:00:05 时间筛选从此刻结束(不包含前s)

# SDK封装方法使用示例:

$Lxapi = new \Lexiangla\Openapi\Api(AppKey, AppSecret);
$response = $Lxapi->get('exams?per_page=2');

# 响应document

# 200 OK 状态码
{
    "data": [
        {
            "type": "exam",
            "id": "ccab4ed4500911f0944556fd2exxxxx",
            "attributes": {
                "title": " 测试考试",
                "content": "123",
                "staff_count": 2,
                "honor_issue": {
                    "point": "immediate",
                    "credit": "unified",
                    "credential": "immediate"
                },
                "privilege_type": 1,
                "pass_score": 3,
                "duration": 60,
                "finished_privilege": 3,
                "ended_privilege": 3,
                "mistake_privilege": 1,
                "exam_times_limit": 2,
                "limit_switch_count": 3,
                "enable_face_recognition": 0,
                "answer_mode": "single",
                "is_shuffled": 1,
                "started_at": "2025-06-23 16:12:00",
                "ended_at": "2025-06-24 16:12:00",
                "tips_when_start": 1,
                "tips_before_start": 30,
                "tips_before_end": 30,
                "created_at": "2025-06-23 16:12:26",
                "updated_at": "2025-06-23 16:12:27",
                "enable_exam_rank": 1,
                "enable_signature": 1,
                "status": "running",
                "staffs_count": 2,
                "finished_staffs_count": 0,
                "app_source_type": "exam",
                "tags": [
                    "标签"
                ]
            },
            "links": {
                "platform": "https://km.lexiangla.net/teams/k101313/exams/ccab4ed4500911f0944556fd2exxxxxx"
            },
            "relationships": {
                "owner": {
                    "data": {
                        "type": "staff",
                        "id": "LX001"
                    }
                },
                "managers": {
                    "data": [
                        {
                            "type": "staff",
                            "id": "LX001"
                        }
                    ]
                },
                "paper": {
                    "data": {
                        "type": "exam_paper",
                        "id": "092fdafacdda11eda08d3ecc0fxxxxxx"
                    }
                },
                "category": {
                    "data": {
                        "type": "category",
                        "id": "f54a9dfec11e11ecb3172aed1dxxxxxx"
                    }
                },
                "team": {
                    "data": {
                        "type": "team",
                        "id": "0dc00e9608d211ed9b464202dxxxxxx"
                    }
                },
                "tags": {
                    "data": [
                        {
                            "type": "tag",
                            "id": "06d52e10500811f0b34b56bf28xxxxxx"
                        }
                    ]
                }
            }
        },
        {
            "type": "exam",
            "id": "06d29100500811f08a5d56bf28fxxxxxx",
            "attributes": {
                "title": "测试考试 2",
                "content": " 测试",
                "staff_count": 4,
                "honor_issue": {
                    "point": "immediate",
                    "credit": "unified",
                    "credential": "immediate"
                },
                "privilege_type": 1,
                "pass_score": 3,
                "duration": 60,
                "finished_privilege": 3,
                "ended_privilege": 3,
                "mistake_privilege": 1,
                "exam_times_limit": 2,
                "limit_switch_count": 3,
                "enable_face_recognition": 0,
                "answer_mode": "single",
                "is_shuffled": 1,
                "started_at": "2025-06-23 15:57:00",
                "ended_at": "2025-06-23 16:12:16",
                "tips_when_start": 1,
                "tips_before_start": 30,
                "tips_before_end": 30,
                "created_at": "2025-06-23 15:59:45",
                "updated_at": "2025-06-23 16:12:27",
                "enable_exam_rank": 1,
                "enable_signature": 1,
                "status": "end",
                "staffs_count": 4,
                "finished_staffs_count": 3,
                "app_source_type": "exam",
                "tags": [
                    " 考试标签"
                ]
            },
            "links": {
                "platform": "https://km.lexiangla.net/teams/k101313/exams/06d29100500811f08a5d56bfxxxxxxx"
            },
            "relationships": {
                "owner": {
                    "data": {
                        "type": "staff",
                        "id": "LX001"
                    }
                },
                "managers": {
                    "data": [
                        {
                            "type": "staff",
                            "id": "LX001"
                        },
                        {
                            "type": "staff",
                            "id": "LX002"
                        }
                    ]
                },
                "paper": {
                    "data": {
                        "type": "exam_paper",
                        "id": "092fdafacdda11eda08d3ecc0fxxxxxxx"
                    }
                },
                "category": {
                    "data": {
                        "type": "category",
                        "id": "f54a9dfec11e11ecb3172aed1xxxxxxx"
                    }
                },
                "team": {
                    "data": {
                        "type": "team",
                        "id": "0dc00e9608d211ed9b464202d6xxxxxxx"
                    }
                },
                "tags": {
                    "data": [
                        {
                            "type": "tag",
                            "id": "06d52e10500811f0b34b56bfxxxxxxx"
                        }
                    ]
                }
            }
        }
    ],
    "links": {
        "first": "https://lxapi.lexiangla.net/cgi-bin/v1/exams?per_page=2&page=1",
        "last": "https://lxapi.lexiangla.net/cgi-bin/v1/exams?per_page=2&page=8361",
        "prev": null,
        "next": "https://lxapi.lexiangla.net/cgi-bin/v1/exams?per_page=2&page=2"
    },
    "meta": {
        "current_page": 1,
        "from": 1,
        "last_page": 8361,
        "path": "https://lxapi.lexiangla.net/cgi-bin/v1/exams",
        "per_page": 2,
        "to": 2,
        "total": 16721
    },
    "included": [
        {
            "type": "staff",
            "id": "LX001",
            "attributes": {
                "name": "测试",
                "english_name": null,
                "organization": "176\\177"
            }
        },
        {
            "type": "staff",
            "id": "LX001",
            "attributes": {
                "name": "jin.",
                "english_name": null
            }
        },
        {
            "type": "exam_paper",
            "id": "092fdafacdda11eda08d3ecc0fxxxxxx",
            "attributes": {
                "is_shared": true,
                "title": "考试测试",
                "type": "custom",
                "extra_content": {},
                "created_at": "2023-03-29 10:33:05"
            }
        },
        {
            "type": "category",
            "id": "f54a9dfec11e11ecb3172aed1dcd5bca",
            "attributes": {
                "name": " 123",
                "weight": 0
            }
        },
        {
            "type": "team",
            "id": "0dc00e9608d211ed9b464202d65xxxxxx",
            "attributes": {
                "code": "k10xxxxxx",
                "name": "测试K吧",
                "type": 2,
                "logo": "https://km.lexiangla.net/assets/e037138e08d111edbc1c4202d65xxxx",
                "signature": "",
                "is_secret": 0,
                "application": [
                    "knowledge",
                    "event",
                    "album",
                    "survey",
                    "exam",
                    "course",
                    "liveroom",
                    "share",
                    "roadmap",
                    "collection"
                ]
            },
            "links": {
                "platform": "https://km.lexiangla.net/teams/k10xxxxx"
            }
        },
        {
            "type": "tag",
            "id": "06d52e10500811f0b34b56bf28xxxxx",
            "attributes": {
                "name": " 测试考试",
                "recommended_at": null
            }
        }
    ]
}

# 参数说明:

参数 说明
title 考试主题
started_at 考试开始时间
ended_at 考试截止时间
status 考试状态(running:进行中;end:考试结束;published:待考)
staff_count 应考人数
finished_staffs_count 已考人数
created_at 创建时间
app_source_type 应用来源:exam,考试;roadmap,项目
relationships.tags 关联标签
included.staff.organization 所属部门
answer_mode 电脑端答题设置 single=逐题模式, all=整页模式
mistake_privilege 错题本设置,1 表示开启,0表示关闭
enable_signature 是否开启考前签名,1 表示开启,0表示关闭
enable_exam_rank 是否开启考试排行榜,1 表示开启,0表示关闭
honor_issue.point 积分颁发时间设置:unified = 考试结束后统一颁发;immediate = 考生符合条件后立即颁发
honor_issue.credit 学分颁发时间设置:unified = 考试结束后统一颁发;immediate = 考生符合条件后立即颁发
honor_issue.credential 证书颁发时间设置:unified = 考试结束后统一颁发;immediate = 考生符合条件后立即颁发
credential_condition 证书颁发条件:exam_event_finish = 提交考卷;exam_event_pass = 考试合格
credential_enabled 是否开启证书,1 表示开启,0表示关闭
credential_is_notify 是否开启证书颁发消息通知,1 表示开启,0表示关闭
data.relationships.point_plus 积分
data.relationships.point_plus.condition 积分颁发条件:exam_event_finish = 提交考卷;exam_event_pass = 考试合格
data.relationships.point_plus.enabled 是否开启积分,1 表示开启,0表示关闭
data.relationships.point_plus.point 积分颁发分值

# 获取单个成员考试列表

# 接口调用说明:

GET https://lxapi.lexiangla.com/cgi-bin/v1/staffs/{staff_id}/exams?filter[started_at][since]=2022-06-16&filter[started_at][until]=2022-06-18

# 参数说明:

参数 是否必须 默认值 说明
staff_id 员工帐号
original_event_status 考生当前考试状态,waiting:待考;active:考试中;finished:已交卷;reexamining:重考中;不传参:数据返回finished , reexamining两种状态
app_source_type 考试的应用来源,为空或不传获取的是全部,exam:来自考试应用,roadmap:来自项目
filter[started][since] 开始日期(包含),根据考试开始时间范围进行过滤。since格式:2022-06-16
filter[started][until] 结束日期(不包含),根据考试开始时间范围进行过滤。until格式:2022-06-18

# SDK封装方法使用示例:

$Lxapi = new \Lexiangla\Openapi\Api(AppKey, AppSecret);
$response = $Lxapi->get('staffs/ThreeZhang/exams');

# 响应document

# 200 OK 状态码
{
    "data": [
        {
            "type": "exam",
            "id": "83e38712effb11eebddf76567ee257cc",
            "attributes": {
                "title": "考试1",
                "content": "<p>考试说明</p>",
                "staff_count": 173,
                "privilege_type": 1,
                "pass_score": 30,
                "duration": null,
                "finished_privilege": 0,
                "ended_privilege": 0,
                "exam_times_limit": 1,
                "limit_switch_count": 0,
                "enable_face_recognition": 0,
                "is_shuffled": 0,
                "started_at": "2024-04-01 15:38:00",
                "ended_at": "2024-04-03 15:38:00",
                "tips_when_start": 0,
                "tips_before_start": 0,
                "tips_before_end": 0,
                "created_at": "2024-04-01 15:43:22",
                "updated_at": "2024-04-01 15:45:34",
                "status": "running",
                "staffs_count": 173,
                "original_event_status": "finished",
                "event_status": "failed",
                "review_status": "unreviewed",
                "finish_at": "2024-04-01 15:53:56",
                "result_score": 4,
                "max_score_used_time": null,
                "avg_used_time": null,
                "app_source_type": "roadmap"
            },
            "links": {
                "platform": "https://km.lexiangla.com/exams/83e38712effb11eebddf76567ee257cc"
            }
        },
        {
            "type": "exam",
            "id": "27787634efe411ee821646512792a9a0",
            "attributes": {
                "title": "考试2",
                "content": "<p>考试说明</p>",
                "staff_count": 174,
                "privilege_type": 1,
                "pass_score": 5,
                "duration": 30,
                "finished_privilege": 0,
                "ended_privilege": 0,
                "exam_times_limit": 1,
                "limit_switch_count": 0,
                "enable_face_recognition": 0,
                "is_shuffled": 0,
                "started_at": "2024-04-01 00:00:00",
                "ended_at": "2024-09-16 20:00:00",
                "tips_when_start": 0,
                "tips_before_start": 0,
                "tips_before_end": 0,
                "created_at": "2024-04-01 12:56:08",
                "updated_at": "2024-04-01 12:56:33",
                "status": "running",
                "staffs_count": 174,
                "original_event_status": "finished",
                "event_status": "failed",
                "review_status": "unreviewed",
                "finish_at": "2024-04-01 12:58:54",
                "result_score": 0,
                "max_score_used_time": 5,
                "avg_used_time": 5,
                "app_source_type": "exam"
            },
            "links": {
                "platform": "https://km.lexiangla.com/exams/27787634efe411ee821646512792a9a0"
            },
            "relationships": {
                "category": {
                    "data": {
                        "type": "category",
                        "id": "220fb43aa8b311eb9faea2a49d53249d"
                    }
                },
                "tags": {
                    "data": [
                        {
                            "type": "tag",
                            "id": "11a8547ab47f11e796b95254002b6735"
                        },
                        {
                            "type": "tag",
                            "id": "4b4e5392e28011ee8554620a3b06ad5c"
                        },
                        {
                            "type": "tag",
                            "id": "fc7fbfb87e3f11e7853a5254002b6735"
                        }
                    ]
                }
            }
        }
    ],
    "links": {
        "first": "https://lxapi.lexiangla.com/cgi-bin/v1/staffs/sandxu/exams?per_page=2&page=1",
        "last": "https://lxapi.lexiangla.com/cgi-bin/v1/staffs/sandxu/exams?per_page=2&page=4",
        "prev": null,
        "next": "https://lxapi.lexiangla.com/cgi-bin/v1/staffs/sandxu/exams?per_page=2&page=2"
    },
    "meta": {
        "current_page": 1,
        "from": 1,
        "last_page": 4,
        "path": "https://lxapi.lexiangla.com/cgi-bin/v1/staffs/sandxu/exams",
        "per_page": 2,
        "to": 2,
        "total": 8
    },
    "included": [
        {
            "type": "category",
            "id": "220fb43aa8b311eb9faea2a49d53249d",
            "attributes": {
                "name": "通用考试",
                "weight": -999
            }
        },
        {
            "type": "tag",
            "id": "11a8547ab47f11e796b95254002b6735",
            "attributes": {
                "name": "3",
                "recommended_at": null
            }
        },
        {
            "type": "tag",
            "id": "4b4e5392e28011ee8554620a3b06ad5c",
            "attributes": {
                "name": "1",
                "recommended_at": null
            }
        },
        {
            "type": "tag",
            "id": "fc7fbfb87e3f11e7853a5254002b6735",
            "attributes": {
                "name": "2",
                "recommended_at": null
            }
        },
        {
            "type": "roadmap",
            "id": "5527",
            "attributes": {
                "title": "项目",
                "checkpoint_count": 4,
                "content": "",
                "created_at": "2024-04-01 15:37:54",
                "cover": "",
                "subject_type": "training",
                "status": 1
            }
        }
    ]
}

# 参数说明:

参数 说明
title 考试主题
started_at 考试开始时间
ended_at 考试截止时间
status 考试状态(running:进行中;end:考试结束;published:待考)
created_at 考试创建时间
original_event_status 考生当前考试状态(waiting:待考;active:考试中;finished:已交卷;reexamining:重考中;)
event_status 考生当前考试状态补充说明(适用于管理员关注):waiting、active和original_event_status 一致;当original_event_status是finished或reexamining时,会根据考试设置的及格成绩,及格即passed,不及格即failed,未设置及格分时,都为finished(不会出现reexamining)
review_status 考生答卷人工阅卷状态(reviewed:已阅卷;unreviewed:未阅卷)
finish_at 交卷时间
result_score 答卷得分
max_score_used_time 最高分用时,单位:秒数
avg_used_time 平均用时,适用于可重考的考试,单位:秒数
relationships.category 考试的分类信息
relationships.tags 关联标签

# 获取单场考试单个成员成绩

# 接口调用说明:

GET https://lxapi.lexiangla.com/cgi-bin/v1/exams/{exam_id}/staffs/{staff_id}

# 参数说明:

参数 是否必须 默认值 说明
exam_id 要获取考试答卷的考试id
staff_id 要获取考试成绩的员工帐号

# SDK封装方法使用示例:

$Lxapi = new \Lexiangla\Openapi\Api(AppKey, AppSecret);
$response = $Lxapi->get('exams/c44f187e2b0a11ecb4bb1aed1721bea0/staffs/' . $staff_id);

# 响应document

# 200 OK 状态码
{
    "data": {
        "type": "staff",
        "id": "LX001",
        "attributes": {
            "name": "zhangsan",
            "english_name": "zhangsan",
            "organization": "研发管理部",
            "original_event_status": "reexamining",
            "event_status": "finished",
            "review_status": "unreviewed",
            "finish_at": "2021-06-18 10:23:33",
            "result_score": 60,
            "max_score_used_time": 13,
            "avg_used_time": 13,
            "signature":"https://xx.xxxxx.xxx/xxxx/xxxxxxxxx",
            "face_image":"https://xx.xxxxx.xxx/xxxx/xxxxxxxxx"
          
        }
    },
    "links": {
        "self": "https://lxapi.lexiangla.com/cgi-bin/v1/staffs/LX001"
    }
}

# 参数说明:

参数 说明
name 考生姓名
english_name 考生英文名
organization 考生部门
original_event_status 考生当前考试状态(waiting:待考;active:考试中;finished:已交卷;reexamining:重考中;)
event_status 考生当前考试状态补充说明(适用于管理员关注):waiting、active跟original_event_status 一致;当original_event_status是finished或reexamining时,会根据考试设置的及格成绩,及格即passed,不及格即failed,未设置及格分时,都为finished(不会出现reexamining)
review_status 考生答卷人工阅卷状态(reviewed:已阅卷;unreviewed:未阅卷)
finish_at 交卷时间
result_score 答卷得分
max_score_used_time 最高分用时,单位:秒数
avg_used_time 平均用时,适用于可重考的考试,单位:秒数
signature 考生签名,考生如果考了多次,只获取最高成绩的那一次签名
face_image 人脸识别照片,当场考试中该考生的最新人脸识别图片

# 获取单个考试信息

# 接口调用说明:

GET https://lxapi.lexiangla.com/cgi-bin/v1/exams/{exam_id}

# 参数说明:

参数 参数类型 是否必须 默认值 说明
exam_id string 考试id

# SDK封装方法使用示例:

$Lxapi = new \Lexiangla\Openapi\Api(AppKey, AppSecret);
$response = $Lxapi->get('exams/' . $exams_id);

# 响应document

# 200 OK 状态码
{
    "data": {
        "type": "exam",
        "id": "26370588500011f0910eb2c2fxxxxx",
        "attributes": {
            "title": "考试",
            "content": "",
            "staff_count": 272,
            "honor_issue": {
                "point": "immediate",
                "credit": "unified",
                "credential": "immediate"
            },
            "privilege_type": 0,
            "pass_score": 30,
            "duration": 60,
            "finished_privilege": 3,
            "ended_privilege": 3,
            "mistake_privilege": 1,
            "exam_times_limit": 3,
            "limit_switch_count": 5,
            "enable_face_recognition": 1,
            "answer_mode": "all",
            "is_shuffled": 1,
            "started_at": "2025-06-23 15:00:00",
            "ended_at": "2025-07-06 15:00:00",
            "tips_when_start": 1,
            "tips_before_start": 30,
            "tips_before_end": 30,
            "created_at": "2025-06-23 15:03:21",
            "updated_at": "2025-06-23 15:08:48",
            "enable_exam_rank": 1,
            "enable_signature": 1,
            "credential_condition": "exam_event_pass",
            "credential_enabled": true,
            "credential_is_notify": true,
            "status": "running",
            "staffs_count": 272,
            "app_source_type": "exam",
            "tags": [
                "标签"
            ]
        },
        "links": {
            "platform": "https://km.lexiangla.net/exams/26370588500011f0910eb2c2f0xxxxx"
        },
        "relationships": {
            "owner": {
                "data": {
                    "type": "staff",
                    "id": "lunattian"
                }
            },
            "managers": {
                "data": [
                    {
                        "type": "staff",
                        "id": "LX001"
                    }
                ]
            },
            "paper": {
                "data": {
                    "type": "exam_paper",
                    "id": "260e0994500011f0a115b2c2f0xxxxx"
                }
            },
            "category": {
                "data": {
                    "type": "category",
                    "id": "12d79066505211ee89b67e7d09xxxxx"
                }
            },
            "certificates": {
                "data": [
                    {
                        "type": "certificate",
                        "id": 632
                    }
                ]
            },
            "tags": {
                "data": [
                    {
                        "type": "tag",
                        "id": "263b1fe2500011f0b522b2c2fxxxxx"
                    },
                    {
                        "type": "tag",
                        "id": "263ed2fe500011f09410b2c2xxxxx"
                    }
                ]
            },
            "credit_rule": {
                "data": {
                    "type": "credit_rule",
                    "id": 139xxxxx
                }
            },
            "point_plus": {
                "data": {
                    "type": "point_plus",
                    "id": "264506f6500011f0871cb2c2fxxxxx9"
                }
            }
        }
    },
    "included": [
        {
            "type": "staff",
            "id": "LX001",
            "attributes": {
                "name": "LX001",
                "english_name": null,
                "organization": "145"
            }
        },
        {
            "type": "exam_paper",
            "id": "260e0994500011f0a115b2c2fxxxxx",
            "attributes": {
                "is_shared": false,
                "title": "考试xxxxx",
                "type": "question_lib",
                "extra_content": {
                    "select_type": 1,
                    "select_data": [
                        {
                            "score": {
                                "single": 5,
                                "multiple": 5,
                                "judgement": 5,
                                "fill": 5,
                                "open": 5
                            },
                            "count": {
                                "single": 5,
                                "multiple": 5,
                                "judgement": 5,
                                "fill": 5,
                                "open": 5
                            },
                            "multiple_score_rule": {
                                "type": 1,
                                "partial_score": 0
                            }
                        }
                    ]
                },
                "created_at": "2025-06-23 15:03:21"
            }
        },
        {
            "type": "category",
            "id": "12d79066505211ee89b67e7d095xxxxx6",
            "attributes": {
                "name": "xxxxx",
                "weight": 1
            }
        },
        {
            "type": "certificate",
            "id": 632,
            "attributes": {
                "title": "xxxxx",
                "code_fixed": "LX24cs001",
                "code_weight": 9,
                "total_num": 34,
                "period": 5,
                "created_at": "2024-12-24 15:20:19",
                "updated_at": "2025-06-16 10:26:25",
                "preview": "https://km.lexiangla.net/assets/cbf5ae0cc1c611efb015c276bc9xxxxx",
                "valid_num": "16"
            }
        },
        {
            "type": "tag",
            "id": "263b1fe2500011f0b522b2c2f059xxxxx",
            "attributes": {
                "name": "标签",
                "recommended_at": null
            }
        },
        {
            "type": "tag",
            "id": "263ed2fe500011f09410b2c2f05xxxxx",
            "attributes": {
                "name": "测试考试",
                "recommended_at": null
            }
        },
        {
            "type": "credit_rule",
            "id": 139072xxx,
            "attributes": {
                "rule_name": "exam_event_pass",
                "credit": 4
            }
        },
        {
            "type": "point_plus",
            "id": "264506f6500011f0871cb2c2f05xxxxx",
            "attributes": {
                "condition": "exam_event_pass",
                "enabled": 1,
                "point": 3
            }
        }
    ],
    "links": {
        "self": "https://lxapi.lexiangla.net/cgi-bin/v1/exams/26370588500011f0910eb2c2f0xxxxxx"
    }
}

# 响应字段说明:

参数 说明
data.attributes.title 考试名称
data.attributes.started_at 开始考试时间
data.attributes.ended_at 结束考试时间
data.attributes.status 状态:draft 草稿;publishing 发布中;failed 发布失败;published 待考状态;running 考试进行中;end 考试结束
data.attributes.created_at 创建时间
data.attributes.app_source_type 应用来源:exam,考试;roadmap,项目
data.attributes.answer_mode 电脑端答题设置 single=逐题模式, all=整页模式
data.attributes.mistake_privilege 错题本设置,1 表示开启,0表示关闭
data.attributes.enable_signature 是否开启考前签名,1 表示开启,0表示关闭
data.attributes.enable_exam_rank 是否开启考试排行榜,1 表示开启,0表示关闭
data.attributes.honor_issue.point 积分颁发时间设置:unified = 考试结束后统一颁发;immediate = 考生符合条件后立即颁发
data.attributes.honor_issue.credit 学分颁发时间设置:unified = 考试结束后统一颁发;immediate = 考生符合条件后立即颁发
data.attributes.honor_issue.credential 证书颁发时间设置:unified = 考试结束后统一颁发;immediate = 考生符合条件后立即颁发
data.attributes.credential_condition 证书颁发条件:exam_event_finish = 提交考卷;exam_event_pass = 考试合格
data.attributes.credential_enabled 是否开启证书,1 表示开启,0表示关闭
data.attributes.credential_is_notify 是否开启证书颁发消息通知,1 表示开启,0表示关闭
data.relationships.owner 创建者
data.relationships.managers 考试管理员
data.relationships.paper 考试使用的试卷
data.relationships.privilege 部分人可见关联的组织架构对象,仅当 privilege_type 为1时
返回多个 staff,department,contact_tag 对象
data.relationships.category 考试分类
data.relationships.certificates 考试证书
data.relationships.team 考试所属K吧
data.relationships.tags 关联标签
data.relationships.credit_rule 考试学分
data.relationships.point_plus.condition 积分颁发条件:exam_event_finish = 提交考卷;exam_event_pass = 考试合格
data.relationships.point_plus.enabled 是否开启积分,1 表示开启,0表示关闭
data.relationships.point_plus.point 积分颁发分值
data.included.staff.organization 所属部门

# 创建考试

# 接口调用说明:

POST https://lxapi.lexiangla.com/cgi-bin/v1/exams

# 请求document

{
    "data": {
        "type": "exam", 
        "attributes": {
            "title": "接口创建考试", 
            "content": "考试说明", 
            "privilege_type": 1, 
            "pass_score": 100, 
            "duration": 30, 
            "finished_privilege": 0, 
            "ended_privilege": 0, 
            "started_at": "2021-09-15 00:00:00", 
            "ended_at": "2021-09-16 20:00:00", 
            "is_shuffled": 0, 
            "tips_when_start": 0, 
            "tips_before_start": 0, 
            "tips_before_end": 0, 
            "exam_times_limit": 1, 
            "limit_switch_count": 0, 
            "enable_face_recognition": 0, 
            "notify_when_issue_certificate": 1, 
            "point_plus": 20,
            "credit": 0.01,
            "enable_exam_rank": 1,
            "honor_issue": {
              "credit": "unified",
              "point": "immediate",
              "credential": "immediate"
            },
            "credential_condition":"exam_event_pass",
            "point_condition":"exam_event_pass",
            "credit_condition":"exam_event_pass",
            "tags": [
                "1", 
                "2", 
                "3"
            ]
        }, 
        "relationships": {
            "paper": {
                "data": {
                    "type": "exam_paper", 
                    "id": "69a9752eff7211e9821a0242ac140005"
                }
            }, 
            "managers": {
                "data": [
                    {
                        "type": "staff", 
                        "id": "lisi"
                    }, 
                    {
                        "type": "staff", 
                        "id": "wangwu"
                    }
                ]
            }, 
            "team": {
                "data": {
                    "type": "team", 
                    "id": "0e018686768911e7b8120800278acc25"
                }
            }, 
            "category": {
                "data": {
                    "type": "category", 
                    "id": "f5f0fb34d56211ebb60e0242ac140005"
                }
            }, 
            "certificates": {
                "data": [
                    {
                        "type": "certificate", 
                        "id": 1
                    }
                ]
            }, 
            "privileges": {
                "data": [
                    {
                        "type": "staff", 
                        "id": "lisi"
                    }, 
                    {
                        "type": "department", 
                        "id": "1"
                    }, 
                    {
                        "type": "contact_tag", 
                        "id": "2"
                    }
                ]
            }
        }
    }
}

# 参数说明:

参数 参数类型 是否必须 默认值 说明
type string 固定值exam,表示考试
attributes.title string 考试标题
attributes.content string 考试说明
attributes.duration int 考试时长,单位分钟
attributes.started_at string 考试开始时间
attributes.ended_at string 考试结束时间
attributes.exam_times_limit int 1 考试次数限制,设置范围1~999,取最高成绩为最终成绩
attributes.pass_score int 0 考试通过分数
attributes.enable_face_recognition bool 0 是否开启人脸认证
attributes.is_shuffled int 0 防作弊设置:选项乱序,0 禁用;1 启用
attributes.limit_switch_count int 0 防作弊设置:限制切屏次数,最多可设100次
attributes.finished_privilege int 0 考试交卷后:1 得分可见;2 得分可见+对错可见;3 得分可见+对错可见+正确答案可见
attributes.ended_privilege int 0 考试结束后:1 得分可见;2 得分可见+对错可见;3 得分可见+对错可见+正确答案可见
attributes.tips_when_start int 0 开考时提醒:0 禁用;1 启用
attributes.tips_before_start int 0 开考前多少分钟提醒
attributes.tips_before_end int 0 结束前多少分钟提醒
attributes.point_plus int 0 通过考试可以获得多少积分
attributes.notify_when_issue_certificate bool 0 证书发放提醒,1表示勾选企业微信通知,0则不勾选,需要与relationships.certificates搭配使用
attributes.privilege_type int 0 考生范围:0 全部人;1 部分人,当privilege_type=1的时候需要和relationships.privileges一起使用
attributes.enable_exam_rank int 0 是否开启考试排行榜
attributes.honor_issue.credit string 学分颁发时机,可选:unified(考试结束后统一颁发),immediate(考生符合条件后立即颁发)
attributes.honor_issue.point string 积分颁发时机,可选:unified(考试结束后统一颁发),immediate(考生符合条件后立即颁发)
attributes.honor_issue.credential string 证书颁发时机,可选:unified(考试结束后统一颁发),immediate(考生符合条件后立即颁发)
attributes.credential_condition string 证书颁发条件,可选:exam_event_pass(考试合格),exam_event_finish(提交试卷)。当 attributes.honor_issue.credential=immediate 时必填
attributes.point_condition string 积分颁发条件,可选:exam_event_pass(考试合格),exam_event_finish(提交试卷)。当 attributes.honor_issue.point=immediate 时必填
attributes.credit_condition string 学分颁发条件,可选:exam_event_pass(考试合格),exam_event_finish(提交试卷)。当 attributes.honor_issue.credit=immediate 时必填
attributes.tags array 考试标签
relationships.paper object 关联的资源对象,类型为 exam_paper,表示考试使用的试卷
relationships.managers array 关联的资源对象,类型为 staff,表示考试管理员
relationships.privileges array 关联多个资源对象,类型为 staff、department、contact_tag,表示考生范围,当 privilege_type 为 1 时有效
relationships.category object 关联的资源对象,类型为 category,表示考试所属类型
relationships.certificates array 关联的资源对象,类型为 certificate,表示考试通过后发放的证书,目前限制只能 1 个证书
relationships.team object 关联的资源对象,类型为 team,表示在哪个 K 吧创建考试

在K吧里创建考试,使用了其他K吧的私密试卷,会提示试卷无法被使用

# SDK封装方法使用示例:

$attributes = [
    "title" => '接口考试',
    "privilege_type" => 1, //考生范围 -必填
    "started_at" => "2021-09-15 00:00:00",
    "ended_at" => "2021-10-01 20:00:00",
    "paper_id" => "2932d120d3fb11eba9db12ed68e25976",
];
$options = [
    "content" => "考试说明",
    "pass_score" => 1,
    "duration" => 30,
    "finished_privilege" => 3, //考试交卷后
    "ended_privilege" => 3, //考试结束后
    "is_shuffled" => 1, //防作弊设置:选项乱序
    "tips_when_start" => 1,
    "tips_before_start" => 10,
    "tips_before_end" => 10,
    "exam_times_limit" => 1,
    "limit_switch_count" => 10, //切屏次数
    "enable_face_recognition" => 1, //人脸认证
    "notify_when_issue_certificate" => 1, //证书发放提醒
    "point_plus" => 20, //--
    "team_id" => "6c55d9b0255111eb82ddd65f6f6227c1",
    "category_id" => "220fb43aa8b311eb9faea2a49d53249d",
    "managers_ids" => [ //管理员
        "lisi",
        "zhangsan"
    ],
    "certificates_ids" => [ //证书
        "1"
    ],
    "privileges" => [ //选择用户范围
        ["type" => "staff", "id" => "lisi"],
        ["type" => "staff", "id" => "zhangsan"],
        ["type" => "department", "id" => "1"],
        ["type" => "contact_tag", "id" => "25d992dc203811ec8262f23f2082154b"]

    ]
];
$Lxapi = new \Lexiangla\Openapi\Api(AppKey, AppSecret);
$response = $Lxapi->postExam($staff_id, $attributes, $options);

# 响应document

# 201 Created 状态码
{
    "data": {
        "type": "exam", 
        "id": "242f22661c6511ec93df0242ac150007", 
        "attributes": {
            "title": "接口创建考试", 
            "content": "",
            "honor_issue": {
                "point": "immediate",
                "credit": "unified",
                "credential": "immediate"
            },
            "privilege_type": 1, 
            "pass_score": null, 
            "duration": null, 
            "finished_privilege": 0, 
            "ended_privilege": 0, 
            "started_at": "2021-09-15 00:00:00", 
            "ended_at": "2021-09-16 20:00:00", 
            "is_shuffled": 0, 
            "staff_count": 0, 
            "tips_when_start": 0, 
            "tips_before_start": 0, 
            "tips_before_end": 0, 
            "exam_times_limit": 1, 
            "limit_switch_count": 0, 
            "enable_face_recognition": 0, 
            "created_at": "2021-09-23 19:55:26", 
            "updated_at": "2021-09-23 19:55:26", 
            "status": "draft", 
            "staffs_count": 0,
            "enable_exam_rank": 1,
            "tags": ["1", "2", "3"]
        }, 
        "links": {
            "platform": "http://lexiangla.com/teams/new/exams/242f22661c6511ec93df0242ac150007"
        }, 
        "relationships": {
            "owner": {
                "data": {
                    "type": "staff", 
                    "id": "zhangsan"
                }
            }, 
            "managers": {
                "data": [
                    {
                        "type": "staff", 
                        "id": "lisi"
                    }, 
                    {
                        "type": "staff", 
                        "id": "wangwu"
                    }
                ]
            }, 
            "paper": {
                "data": {
                    "type": "exam_paper", 
                    "id": "69a9752eff7211e9821a0242ac140005"
                }
            }, 
            "category": {
                "data": {
                    "type": "category", 
                    "id": "f5f0fb34d56211ebb60e0242ac140005"
                }
            }, 
            "certificates": {
                "data": [
                    {
                        "type": "certificate", 
                        "id": 1
                    }
                ]
            }, 
            "team": {
                "data": {
                    "type": "team", 
                    "id": "0e018686768911e7b8120800278acc25"
                }
            }, 
            "tags": {
                "data": [
                    {
                        "type": "tag", 
                        "id": "11a8547ab47f11e796b95254002b6735"
                    }, 
                    {
                        "type": "tag", 
                        "id": "4b4e5392e28011ee8554620a3b06ad5c"
                    }, 
                    {
                        "type": "tag", 
                        "id": "fc7fbfb87e3f11e7853a5254002b6735"
                    }
                ]
            },
            "point_plus": {
                "data": {
                    "type": "point_plus",
                    "id": "2bd91d98783011f0ae460242c0a8c012"
                }
            },
            "credit_rule": {
                "data": {
                    "type": "credit_rule",
                    "id": 15
                }
            }
        }
    }, 
    "included": [
        {
            "type": "staff", 
            "id": "zhangsan", 
            "attributes": {
                "name": "张三", 
                "english_name": "zhangsan"
            }
        }, 
        {
            "type": "staff", 
            "id": "lisi", 
            "attributes": {
                "name": "李四", 
                "english_name": "lisi"
            }
        }, 
        {
            "type": "staff", 
            "id": "wangwu", 
            "attributes": {
                "name": "王五", 
                "english_name": "wangwu"
            }
        }, 
        {
            "type": "exam_paper", 
            "id": "69a9752eff7211e9821a0242ac140005", 
            "attributes": {
                "is_shared": true, 
                "title": "试卷一", 
                "type": "custom", 
                "extra_content": { }
            }
        }, 
        {
            "type": "category", 
            "id": "f5f0fb34d56211ebb60e0242ac140005", 
            "attributes": {
                "name": "通用能力考试"
            }
        }, 
        {
            "type": "certificate", 
            "id": 1, 
            "attributes": {
                "title": "考试证书", 
                "code_fixed": "1321312", 
                "code_weight": 5, 
                "total_num": 0, 
                "period": 12, 
                "preview": "http://lexiangla.com/assets/328fdf1a16e511ec979f0242ac140005", 
                "created_at": "2021-09-16 19:57:04", 
                "updated_at": "2021-09-16 19:57:04", 
                "valid_num": 0
            }
        }, 
        {
            "type": "team", 
            "id": "0e018686768911e7b8120800278acc25", 
            "attributes": {
                "code": "k0001", 
                "name": "考试吧", 
                "type": 2, 
                "logo": null, 
                "signature": "", 
                "is_secret": 0
            }
        }, 
        {
            "type": "tag", 
            "id": "11a8547ab47f11e796b95254002b6735", 
            "attributes": {
                "name": "3", 
                "recommended_at": null
            }
        }, 
        {
            "type": "tag", 
            "id": "4b4e5392e28011ee8554620a3b06ad5c", 
            "attributes": {
                "name": "1", 
                "recommended_at": null
            }
        }, 
        {
            "type": "tag", 
            "id": "fc7fbfb87e3f11e7853a5254002b6735", 
            "attributes": {
                "name": "2", 
                "recommended_at": null
            }
        },
        {
            "type": "point_plus",
            "id": "2bd91d98783011f0ae460242c0a8c012",
            "attributes": {
                "condition": "exam_event_pass",
                "enabled": 1,
                "point": 20
            }
        },
        {
            "type": "credit_rule",
            "id": 15,
            "attributes": {
                "rule_name": "exam_event_pass",
                "credit": 1
            }
        }
    ], 
    "links": {
        "self": "http://lexiangla.com/cgi-bin/v1/exams/242f22661c6511ec93df0242ac150007"
    }
}

# 发布考试

异步发布,后续可调用获取单个考试信息 接口获取考试的状态,验证考试是否发布成功

# 接口调用说明:

PUT https://lxapi.lexiangla.com/cgi-bin/v1/exams/{exam_id}/publish

# 参数说明:

参数 参数类型 是否必须 默认值 说明
exam_id string 考试id

# SDK封装方法使用示例:


$Lxapi = new \Lexiangla\Openapi\Api(AppKey, AppSecret);
$response = $Lxapi->putExamPublish($staff_id, $exam_id);

# 响应document

# 202 Accepted 状态码
{
  "data": {
    "type": "exam", 
    "id": "6e54749e6f9f11ecb038067fe8c173c3", 
    "attributes": {
      "title": "创建考试", 
      "content": "考试说明内容",
      "honor_issue": {
          "point": "immediate",
          "credit": "unified",
          "credential": "immediate"
      },
      "staff_count": 0, 
      "privilege_type": 0, 
      "pass_score": 16, 
      "duration": 30, 
      "finished_privilege": 3, 
      "ended_privilege": 3, 
      "exam_times_limit": 1, 
      "limit_switch_count": 100, 
      "enable_face_recognition": 0, 
      "is_shuffled": 1, 
      "started_at": "2022-01-12 00:00:00", 
      "ended_at": "2022-01-20 20:00:00", 
      "tips_when_start": 0, 
      "tips_before_start": 0, 
      "tips_before_end": 0, 
      "created_at": "2022-01-07 17:51:48", 
      "updated_at": "2022-01-07 17:56:21", 
      "status": "publishing", 
      "staffs_count": 0,
      "enable_exam_rank": 1
    }, 
    "links": {
      "platform": "https://lxapi.lexiangla.com/exams/6e54749e6f9f11ecb038067fe8c173c3"
    }
  }, 
  "links": {
    "self": "https://lxapi.lexiangla.com/cgi-bin/v1/exams/6e54749e6f9f11ecb038067fe8c173c3"
  }
}

# 参数说明:

参数 说明
attributes.title 考试标题
attributes.content 考试内容
attributes.honor_issue.point 积分颁发时间设置:unified = 考试结束后统一颁发;immediate = 考生符合条件后立即颁发
attributes.honor_issue.credit 学分颁发时间设置:unified = 考试结束后统一颁发;immediate = 考生符合条件后立即颁发
attributes.honor_issue.credential 证书颁发时间设置:unified = 考试结束后统一颁发;immediate = 考生符合条件后立即颁发
attributes.staff_count 考试的人数
attributes.privilege_type 考生范围:0 全部人;1 部分人
attributes.pass_score 考试通过分数
attributes.duration 考试时长,单位分钟
attributes.finished_privilege 考试交卷后:1 得分可见;2 得分可见+对错可见;3 得分可见+对错可见+正确答案可见
attributes.ended_privilege 考试结束后:1 得分可见;2 得分可见+对错可见;3 得分可见+对错可见+正确答案可见
attributes.exam_times_limit 考试次数限制,最多可设100次,取最高成绩为最终成绩
attributes.limit_switch_count 防作弊设置:限制切屏次数,最多可设100次
attributes.enable_face_recognition 是否开启人脸认证,false or true
attributes.is_shuffled 防作弊设置:选项乱序,0 禁用;1 启用
attributes.started_at 考试开始时间
attributes.ended_at 考试结束时间
attributes.created_at 考试创建时间
attributes.updated_at 考试更新时间
attributes.tips_when_start 开考时提醒:0 禁用;1 启用
attributes.tips_before_start 开考前多少分钟提醒
attributes.tips_before_end 结束前多少分钟提醒
attributes.status 状态:draft 草稿;publishing 发布中;failed 发布失败;published 待考状态;running 考试进行中;end 考试结束
attributes.enable_exam_rank 是否开启考试排行榜:0 关闭;1 开启

# 取消考试

此接口仅待考状态可取消发布

# 接口调用说明:

PUT https://lxapi.lexiangla.com/cgi-bin/v1/exams/{exam_id}/cancel-publish

# 参数说明:

参数 参数类型 是否必须 默认值 说明
exam_id string 考试id

# SDK封装方法使用示例:


$Lxapi = new \Lexiangla\Openapi\Api(AppKey, AppSecret);
$response = $Lxapi->putExamCancelPublish($staff_id, $exam_id);

# 响应document

# 200 OK 状态码
{
  "data": {
    "type": "exam", 
    "id": "6e54749e6f9f11ecb038067fe8c173c3", 
    "attributes": {
      "title": "创建考试", 
      "content": "考试说明内容", 
      "staff_count": 105, 
      "privilege_type": 0, 
      "pass_score": 16, 
      "duration": 30, 
      "finished_privilege": 3, 
      "ended_privilege": 3, 
      "exam_times_limit": 1, 
      "limit_switch_count": 100, 
      "enable_face_recognition": 0, 
      "is_shuffled": 1, 
      "started_at": "2022-01-12 00:00:00", 
      "ended_at": "2022-01-20 20:00:00", 
      "tips_when_start": 0, 
      "tips_before_start": 0, 
      "tips_before_end": 0, 
      "created_at": "2022-01-07 17:51:48", 
      "updated_at": "2022-01-07 17:56:37", 
      "status": "draft", 
      "staffs_count": 105
    }, 
    "links": {
      "platform": "https://lxapi.lexiangla.com/exams/6e54749e6f9f11ecb038067fe8xxxxxx"
    }
  }, 
  "links": {
    "self": "https://lxapi.lexiangla.com/cgi-bin/v1/exams/6e54749e6f9f11ecb038067fe8xxxxxx"
  }
}

# 参数说明:

参数 说明
attributes.title 考试标题
attributes.content 考试内容
attributes.staff_count 考试的人数
attributes.privilege_type 考生范围:0 全部人;1 部分人
attributes.pass_score 考试通过分数
attributes.duration 考试时长,单位分钟
attributes.finished_privilege 考试交卷后:1 得分可见;2 得分可见+对错可见;3 得分可见+对错可见+正确答案可见
attributes.ended_privilege 考试结束后:1 得分可见;2 得分可见+对错可见;3 得分可见+对错可见+正确答案可见
attributes.exam_times_limit 考试次数限制,最多可设100次,取最高成绩为最终成绩
attributes.limit_switch_count 防作弊设置:限制切屏次数,最多可设100次
attributes.enable_face_recognition 是否开启人脸认证,false or true
attributes.is_shuffled 防作弊设置:选项乱序,0 禁用;1 启用
attributes.started_at 考试开始时间
attributes.ended_at 考试结束时间
created_at.created_at 考试创建时间
created_at.updated_at 考试更新时间
attributes.tips_when_start 开考时提醒:0 禁用;1 启用
attributes.tips_before_start 开考前多少分钟提醒
attributes.tips_before_end 结束前多少分钟提醒
attributes.status 状态:draft 草稿;publishing 发布中;failed 发布失败;published 待考状态;running 考试进行中;end 考试结束

# 更新考试

# 接口调用说明:

PATCH https://lxapi.lexiangla.com/cgi-bin/v1/exams/{exam_id}

# 参数说明:

参数 参数类型 是否必须 默认值 说明
exam_id string 考试ID

# 请求document

{
    "data": {
        "type": "exam",
        "attributes": {
            "title": "接口修改考试",
            "content": "考试说明",
            "privilege_type": 1,
            "pass_score": 100,
            "duration": 30,
            "finished_privilege": 1,
            "ended_privilege": 2,
            "started_at": "2021-10-15 10:00:00",
            "ended_at": "2021-10-16 22:00:00",
            "is_shuffled": 1,
            "tips_when_start": 1,
            "tips_before_start": 10,
            "tips_before_end": 10,
            "exam_times_limit": 3,
            "limit_switch_count": 1,
            "enable_face_recognition": 1
        },
        "relationships": {
            "paper": {
                "data": {
                    "type": "exam_paper",
                    "id": "6106675efbaf11e99ca50242ac140005"
                }
            },
            "managers": {
                "data": [
                    {
                        "type": "staff",
                        "id": "lisi"
                    },
                    {
                        "type": "staff",
                        "id": "wangwu"
                    },
                    {
                        "type": "staff",
                        "id": "zhaoliu"
                    }
                ]
            },
            "team": {
                "data": {
                    "type": "team",
                    "id": "0e018686768911e7b8120800278acc25"
                }
            },
            "category": {
                "data": {
                    "type": "category",
                    "id": "f5f0fb34d56211ebb60e0242ac140005"
                }
            },
            "certificates": {
                "data": [
                    {
                        "type": "certificate",
                        "id": "1"
                    }
                ]
            },
            "privileges": {
                "data": [
                    {
                        "type": "staff",
                        "id": "sunqi"
                    },
                    {
                        "type": "department",
                        "id": "1"
                    },
                    {
                        "type": "contact_tag",
                        "id": "2"
                    }
                ]
            }
        }
    }
}

# 参数说明:

参数 参数类型 是否必须 默认值 说明
type string 固定值exam,表示考试
attributes.title string 考试标题
attributes.content string 考试说明
attributes.duration int 考试时长
attributes.started_at string 考试开始时间
attributes.ended_at string 考试结束时间
attributes.exam_times_limit int 1 考试次数限制,设置范围1~999,取最高成绩为最终成绩
attributes.pass_score int 0 考试通过分数
attributes.enable_face_recognition bool false 是否开启人脸认证
attributes.is_shuffled int 0 防作弊设置:选项乱序,0 禁用;1 启用
attributes.limit_switch_count int 0 防作弊设置:限制切屏次数,最多可设100次
attributes.finished_privilege int 0 考试交卷后:1 得分可见;2 得分可见+对错可见;3 得分可见+对错可见+正确答案可见
attributes.ended_privilege int 0 考试结束后:1 得分可见;2 得分可见+对错可见;3 得分可见+对错可见+正确答案可见
attributes.tips_when_start int 0 开考时提醒:0 禁用;1 启用。考试为 running 状态不可编辑
attributes.tips_before_start int 0 开考前多少分钟提醒。考试为 running 状态不可编辑
attributes.tips_before_end int 0 结束前多少分钟提醒
attributes.point_plus int 0 通过考试可以获得多少积分
attributes.notify_when_issue_certificate bool false 证书发放提醒,,1表示勾选企业微信通知,0则不勾选,需要与relationships.certificates搭配使用
attributes.privilege_type int 0 考生范围:0 全部人;1 部分人,当privilege_type=1的时候需要和relationships.privileges一起使用
relationships.paper object 关联的资源对象,类型为 exam_paper,表示考试使用的试卷。考试为 running 状态不可编辑
relationships.managers array 关联的资源对象,类型为 staff,表示考试管理员
relationships.privileges array 关联多个资源对象,类型为 staff、department、contact_tag,表示考生范围,当 privilege_type 为 1 时有效
relationships.category object 关联的资源对象,类型为 category,表示考试所属类型
relationships.certificates array 关联的资源对象,类型为 certificate,表示考试通过后发放的证书,目前限制只能 1 个证书
relationships.team object 关联的资源对象,类型为 team,表示在哪个 K 吧创建考试

# SDK封装方法使用示例:

$attributes = [
    "paper_id" => "2932d120d3fb11eba9db12ed68e25976"
];
$options = [
    "title" => '修改考试',
    "started_at" => "2021-09-15 00:00:00",
    "ended_at" => "2021-11-02 20:00:00",
    "privilege_type" => 1, //考生范围,
    "content" => "修改考试说明",
    "pass_score" => 2,
    "duration" => 10,
    "finished_privilege" => 3, //考试交卷后
    "ended_privilege" => 3, //考试结束后
    "is_shuffled" => 0, //防作弊设置:选项乱序
    "tips_when_start" => 1,
    "tips_before_start" => 1,
    "tips_before_end" => 1,
    "exam_times_limit" => 1,
    "limit_switch_count" => 10, //切屏次数
    "enable_face_recognition" => 1, //人脸认证
    "notify_when_issue_certificate" => 1, //证书发放提醒
    "point_plus" => 20, //--
    "team_id" => "6c55d9b0255111eb82ddd65f6f6227c1",
    "category_id" => "220fb43aa8b311eb9faea2a49d53249d",
    "managers_ids" => [ //管理员
        "wangwu",
        "zhangsan"
    ],
    "certificates_ids" => [ //证书
        "100"
    ],

    "privileges" => [ //选择用户范围
        // ["type" => "staff", "id" => "lisi"],
        // ["type" => "department", "id" => "2"],
        ["type" => "contact_tag", "id" => "25d992dc203811ec8262f23f2082154b"]

    ]

];
$Lxapi = new \Lexiangla\Openapi\Api(AppKey, AppSecret);
$response = $Lxapi->patchExam($staff_id, $exam_id, $attributes, $options);

# 响应document

# 200 OK 状态码
{
    "data": {
        "type": "exam",
        "id": "3c9a897e16e511ecbadb0242ac140005",
        "attributes": {
            "title": "接口修改考试",
            "content": "<p>考试说明</p>",
            "privilege_type": 1,
            "pass_score": 100,
            "duration": 30,
            "finished_privilege": 1,
            "ended_privilege": 2,
            "started_at": "2021-10-15 10:00:00",
            "ended_at": "2021-10-16 22:00:00",
            "is_shuffled": 1,
            "staff_count": 0,
            "tips_when_start": 1,
            "tips_before_start": 10,
            "tips_before_end": 10,
            "exam_times_limit": 3,
            "limit_switch_count": 1,
            "enable_face_recognition": 1,
            "created_at": "2021-09-16 19:57:16",
            "updated_at": "2021-09-24 10:51:17",
            "status": "draft",
            "staffs_count": 0
        },
        "links": {
            "platform": "http://lexiangla.com/teams/new/exams/3c9a897e16e511ecbadb0242ac140005"
        },
        "relationships": {
            "owner": {
                "data": {
                    "type": "staff",
                    "id": "zhangsan"
                }
            },
            "managers": {
                "data": [
                    {
                        "type": "staff",
                        "id": "lisi"
                    },
                    {
                        "type": "staff",
                        "id": "wangwu"
                    },
                    {
                        "type": "staff",
                        "id": "zhaoliu"
                    }
                ]
            },
            "paper": {
                "data": {
                    "type": "exam_paper",
                    "id": "6106675efbaf11e99ca50242ac140005"
                }
            },
            "category": {
                "data": {
                    "type": "category",
                    "id": "f5f0fb34d56211ebb60e0242ac140005"
                }
            },
            "certificates": {
                "data": [
                    {
                        "type": "certificate",
                        "id": 1
                    }
                ]
            },
            "team": {
                "data": {
                    "type": "team",
                    "id": "0e018686768911e7b8120800278acc25"
                }
            }
        }
    },
    "included": [
        {
            "type": "staff",
            "id": "zhangsan",
            "attributes": {
                "name": "张三",
                "english_name": "zhangsan"
            }
        },
        {
            "type": "staff",
            "id": "lisi",
            "attributes": {
                "name": "李四",
                "english_name": "lisi"
            }
        },
        {
            "type": "staff",
            "id": "wangwu",
            "attributes": {
                "name": "王五",
                "english_name": "wangwu"
            }
        },
        {
            "type": "staff",
            "id": "zhaoliu",
            "attributes": {
                "name": "赵六",
                "english_name": "zhaoliu"
            }
        },
        {
            "type": "exam_paper",
            "id": "6106675efbaf11e99ca50242ac140005",
            "attributes": {
                "is_shared": true,
                "title": "试卷一",
                "type": "custom",
                "extra_content": {}
            }
        },
        {
            "type": "category",
            "id": "f5f0fb34d56211ebb60e0242ac140005",
            "attributes": {
                "name": "通用能力考试"
            }
        },
        {
            "type": "certificate",
            "id": 1,
            "attributes": {
                "title": "考试证书",
                "code_fixed": "1321312",
                "code_weight": 5,
                "total_num": 0,
                "period": 12,
                "preview": "http://lexiangla.com/assets/328fdf1a16e511ec979f0242ac140005",
                "created_at": "2021-09-16 19:57:04",
                "updated_at": "2021-09-16 19:57:04",
                "valid_num": 0
            }
        },
        {
            "type": "team",
            "id": "0e018686768911e7b8120800278acc25",
            "attributes": {
                "code": "k0001",
                "name": "考试吧",
                "type": 2,
                "logo": null,
                "signature": "",
                "is_secret": 0
            }
        }
    ],
    "links": {
        "self": "http://lexiangla.com/cgi-bin/v1/exams/3c9a897e16e511ecbadb0242ac140005"
    }
}

# 删除考试

# 接口调用说明:

DELETE https://lxapi.lexiangla.com/cgi-bin/v1/exams/{exam_id}

# 参数说明:

参数 参数类型 是否必须 默认值 说明
exam_id string 考试id

# SDK封装方法使用示例:

$Lxapi = new \Lexiangla\Openapi\Api(AppKey, AppSecret);
$response = $Lxapi->deleteExam($staff_id, $exam_id);

# 响应

# 204 No Content 状态码
[]

待考和进行中不适用该接口

# 创建试卷

# 接口调用说明:

POST https://lxapi.lexiangla.com/cgi-bin/v1/exam-papers

# 请求document(随机试卷)

{
    "data": {
        "attributes": {
            "title": "试卷一",
            "type": "question_lib",
            "is_shared": 1,
            "extra_content": {
                "select_type": 2,
                "select_data": [
                    {
                        "score": {
                            "single": 1000,
                            "multiple": 10,
                            "judgement": 20,
                            "fill": 30,
                            "open": 10
                        },
                        "count": {
                            "single": 1,
                            "multiple": 2,
                            "judgement": 3,
                            "fill": 4,
                            "open": 5
                        },
                        "question_lib_id": "c96157b2121611ecacdb1aa67c324c49"
                    },
                    {
                        "score": {
                            "single": 1000,
                            "multiple": 10,
                            "judgement": 20,
                            "fill": 30,
                            "open": 10
                        },
                        "count": {
                            "single": 1,
                            "multiple": 2,
                            "judgement": 3,
                            "fill": 4,
                            "open": 5
                        },
                        "question_lib_id": "23d792d81e8311ec94783a4078affe10"
                    }
                ]
            }
        },
        "relationships": {
            "team": {
                "data": {
                    "type": "team",
                    "id": "5cc8644c1f4011ec8fd382df10d8bb86"
                }
            }
        }
    }
}

# 请求document(固定试卷)

{
	"data": {
		"attributes": {
			"title": "api固定试卷",
			"type": "custom",
			"is_shared": 1
		},
		"relationships": {
			"team": {
				"data": {
					"type": "team",
					"id": "5cc8644c1f4011ec8fd382df10d8bb86"
				}
			}
		}
	}
}

# 参数说明:

参数 参数类型 是否必须 默认值 说明
attributes.title string 试卷名称
attributes.type string 试卷类型:custom 固定试卷;question_lib 随机试卷
attributes.is_shared bool 1 试卷使用范围:0 私密;1 公开
attributes.extra_content object 当 type=question_lib 时必须,随机试卷的选题策略
attributes.extra_content.select_type int 选题策略类型:1 根据题目类型选题;2 分题库根据题目类型选题,select_type=1的时候需要调用设置题库接口,attributes.type=question_lib,为必填项。
relationships.team object 关联的资源对象,表示试卷所属K吧

当 extra_content.select_type=1,extra_content.select_data(数组长度只能为 1) 格式为:

  • score.single:单选题每题分值
  • score.multiple:多选题每题分值
  • score.judgement:判断题每题分值
  • score.fill:填空题每题分值
  • score.open:问答题每题分值
  • count.single:单选题抽题数量
  • count.multiple:多选题抽题数量
  • count.judgement:判断题抽题数量
  • count.fill:填空题抽题数量
  • count.open:问答题抽题数量
{
    "select_type": 1,
    "select_data":
    [
        {
            "score":
            {
                "single": 1000,
                "multiple": 10,
                "judgement": 20,
                "fill": 30,
                "open": 10
            },
            "count":
            {
                "single": 1,
                "multiple": 2,
                "judgement": 3,
                "fill": 4,
                "open": 5
            }
        }
    ]
}

当 extra_content.select_type=2,extra_content.select_data(数组长度与题库数量对应) 格式为:

  • question_lib_id:从对应的题库抽题
{
    "select_type": 2,
    "select_data":
    [
        {
            "score":
            {
                "single": 1000,
                "multiple": 10,
                "judgement": 20,
                "fill": 30,
                "open": 10
            },
            "count":
            {
                "single": 1,
                "multiple": 2,
                "judgement": 3,
                "fill": 4,
                "open": 5
            },
            "question_lib_id": "f63fbb5efc8b11e992750242ac140005"
        },
        {
            "score":
            {
                "single": 1000,
                "multiple": 10,
                "judgement": 20,
                "fill": 30,
                "open": 10
            },
            "count":
            {
                "single": 1,
                "multiple": 2,
                "judgement": 3,
                "fill": 4,
                "open": 5
            },
            "question_lib_id": "b73fbb5efc8b11e992750242ac140004"
        }
    ]
}

# SDK封装方法使用示例:

# (随机试卷)
//创建试卷-随机卷  
$attributes = [
    "title" => "phpsdk创建随机卷-2",
    "type" => "question_lib",//随机卷
    "select_type" => 2,//题库类型
    "select_data" => [
        [
            "score" => [
                "single" => 1,
                "multiple" => 1,
                "judgement" => 20,
                "fill" => 30,
                "open" => 10
            ],
            "count" => [
                "single" => 1,
                "multiple" => 10,
                "judgement" => 20,
                "fill" => 30,
                "open" => 10
            ],
            "question_lib_id" => "c96157b2121611ecacdb1aa67c324c49" //题库id
        ],
        //题库2
        [
            "score" => [
                "single" => 1,
                "multiple" => 1,
                "judgement" => 1,
                "fill" => 1,
                "open" => 1
            ],
            "count" => [
                "single" => 1,
                "multiple" => 1,
                "judgement" => 1,
                "fill" => 1,
                "open" => 1
            ],
            "question_lib_id" => "23d792d81e8311ec94783a4078affe10" //题库id
        ]
    ]
];
$options = [
    "is_shared" => 1, //公开设置
    "team_id" => $team_id
];

$Lxapi = new \Lexiangla\Openapi\Api(AppKey, AppSecret);
$response = $Lxapi->postExamPaper($staff_id, $attributes, $options);
# (固定试卷)
//创建试卷-固定卷

$attributes = [
    "title" => "phpsdk创建固定卷",
    "type" => "custom",
];
$options = [
    "is_shared" => 1, //公开设置
    "team_id" => $team_id
];

$Lxapi = new \Lexiangla\Openapi\Api(AppKey, AppSecret);
$response = $Lxapi->postExamPaper($staff_id, $attributes, $options);

# 响应document(随机试卷)

# 201 Created 状态码
{
    "data": {
        "attributes": {
            "is_shared": true,
            "created_at": "2021-09-27 15:03:20",
            "extra_content": {
                "select_type": 2,
                "select_data": [
                    {
                        "score": {
                            "single": 1000,
                            "judgement": 20,
                            "multiple": 10,
                            "fill": 30,
                            "open": 10
                        },
                        "count": {
                            "single": 1,
                            "judgement": 3,
                            "multiple": 2,
                            "fill": 4,
                            "open": 5
                        },
                        "question_lib_id": "c96157b2121611ecacdb1aa67c324c49"
                    },
                    {
                        "score": {
                            "single": 1000,
                            "judgement": 20,
                            "multiple": 10,
                            "fill": 30,
                            "open": 10
                        },
                        "count": {
                            "single": 1,
                            "judgement": 3,
                            "multiple": 2,
                            "fill": 4,
                            "open": 5
                        },
                        "question_lib_id": "23d792d81e8311ec94783a4078affe10"
                    }
                ]
            },
            "title": "试卷一",
            "type": "question_lib"
        },
        "id": "ff8892b81f6011ec96d31e514902c5fe",
        "type": "exam_paper"
    },
    "links": {
        "self": "https://lxapi.lexiangla.com/cgi-bin/v1/exam-papers/ff8892b81f6011ec96d31e514902c5fe"
    }
}

# 响应document(固定试卷)

# 201 Created 状态码
{
    "data": {
        "attributes": {
            "is_shared": true,
            "created_at": "2021-09-27 15:13:06",
            "extra_content": {
            },
            "title": "api固定试卷",
            "type": "custom"
        },
        "id": "5ccb74121f6211ecae691e514902c5fe",
        "type": "exam_paper"
    },
    "links": {
        "self": "https://lxapi.lexiangla.com/cgi-bin/v1/exam-papers/5ccb74121f6211ecae691e514902c5fe"
    }
}

# 更新试卷

# 接口调用说明:

PATCH https://lxapi.lexiangla.com/cgi-bin/v1/exam-papers/{exam_paper_id}

# 请求document(随机试卷)

{
    "data": {
        "attributes": {
            "title": "更新试卷",
            "is_shared":1,
            "extra_content": {
                "select_type": 2,
                "select_data": [
                    {
                        "score": {
                            "single": 1000,
                            "multiple": 10,
                            "judgement": 20,
                            "fill": 30,
                            "open": 10
                        },
                        "count": {
                            "single": 1,
                            "multiple": 2,
                            "judgement": 3,
                            "fill": 4,
                            "open": 5
                        },
                        "question_lib_id": "c96157b2121611ecacdb1aa67c324c49"
                    }
                ]
            }
        }
    }
}

# 请求document(固定试卷)

{
    "data": {
        "attributes": {
            "title": "修改试卷",
            "type": "custom",
            "is_shared": 1
        }
    }
}

# 参数说明:

参数 参数类型 是否必须 默认值 说明
exam_paper_id string 试卷id
attributes.title string 试卷名称
attributes.is_shared bool 0 试卷使用范围:0 私密;1 公开
attributes.extra_content object 当 type=question_lib 时必须,随机试卷的选题策略
attributes.extra_content.select_type int 选题策略类型:1 根据题目类型选题;2 分题库根据题目类型选题

attributes.extra_content.select_data 说明见【创建试卷】。

# SDK封装方法使用示例:

# (随机试卷)
//更新题库-随机卷

options = [
    "title" => "php修改随机卷",
    "extra_content" => [
        "select_type" => 2,//题库类型
        "select_data" => [
            [
                "score" => [
                    "single" => 1000,
                    "multiple" => 10,
                    "judgement" => 20,
                    "fill" => 30,
                    "open" => 10
                ],
                "count" => [
                    "single" => 100,
                    "multiple" => 2,
                    "judgement" => 3,
                    "fill" => 4,
                    "open" => 5
                ],
                "question_lib_id" => "c96157b2121611ecacdb1aa67c324c49"//题库id
            ]
        ],
        "is_shared" => 0, //公开设置
    ]
];

$Lxapi = new \Lexiangla\Openapi\Api(AppKey, AppSecret);
$response = $Lxapi->patchExamPaper($staff_id, $papers_id, $options);
# (固定试卷)
 //更新试卷-固定卷
 
$options = [
    "title" => "php修改固定卷",
    "is_shared" => 1, //公开设置
];

$Lxapi = new \Lexiangla\Openapi\Api(AppKey, AppSecret);
$response = $Lxapi->patchExamPaper($staff_id, $papers_id, $options);

# 响应document(随机试卷)

# 200 OK 状态码
{
    "data": {
        "attributes": {
            "is_shared": true,
            "created_at": "2021-09-27 15:03:20",
            "extra_content": {
                "select_type": 2,
                "select_data": [
                    {
                        "score": {
                            "single": 1000,
                            "judgement": 20,
                            "multiple": 10,
                            "fill": 30,
                            "open": 10
                        },
                        "count": {
                            "single": 1,
                            "judgement": 3,
                            "multiple": 2,
                            "fill": 4,
                            "open": 5
                        },
                        "question_lib_id": "c96157b2121611ecacdb1aa67c324c49"
                    }
                ]
            },
            "title": "更新试卷",
            "type": "question_lib"
        },
        "id": "ff8892b81f6011ec96d31e514902c5fe",
        "type": "exam_paper"
    },
    "links": {
        "self": "https://lxapi.lexiangla.com/cgi-bin/v1/exam-papers/ff8892b81f6011ec96d31e514902c5fe"
    }
}

# 响应document(固定试卷)

# 200 OK 状态码
{
    "data": {
        "attributes": {
            "is_shared": true,
            "created_at": "2021-09-29 16:47:34",
            "extra_content": {
            },
            "title": "修改名字",
            "type": "custom"
        },
        "id": "e3fee2f2210111ec9af94eaca76b3a7f",
        "type": "exam_paper"
    },
    "links": {
        "self": "https://lxapi.lexiangla.com/cgi-bin/v1/exam-papers/e3fee2f2210111ec9af94eaca76b3a7f"
    }
}

# 设置随机试卷里的题库

此接口仅对paper.type=question_lib且select_type=1的试卷实体有效

# 接口调用说明:

PATCH https://lxapi.lexiangla.com/cgi-bin/v1/exam-papers/{exam_paper_id}/question_libs

# 请求document

{
    "data": [
        {
            "type": "exam_question_lib",
            "id": "f63fbb5efc8b11e992750242ac140005"
        },
        {
            "type": "exam_question_lib",
            "id": "b63fbb5efc8b11e992750242ac140005"
        }
    ]
}

# 参数说明:

参数 参数类型 是否必须 默认值 说明
exam_paper_id string 试卷id
data array 数组个数限制:[1, 10]
data.type string 固定值为 exam_question_lib
data.id string 题库id

# SDK封装方法使用示例:

$attributes = [
    "exam_question_lib_ids" => [
        "c96157b2121611ecacdb1aa67c324c49",
        "23d792d81e8311ec94783a4078affe10"
    ]
];

$Lxapi = new \Lexiangla\Openapi\Api(AppKey, AppSecret);
$response = $Lxapi->patchExamPaperQuestionlib($staff_id, $attributes, $papers_id);

# 响应

# 204 No Content 状态码
[]

# 设置固定试卷里的题目

此接口仅对paper.type=custom的试卷实体有效

# 接口调用说明:

PATCH https://lxapi.lexiangla.com/cgi-bin/v1/exam-papers/{exam_paper_id}/questions

# 请求document

{
    "data": [
        {
            "type": "exam_question",
            "id": "fce949f2fc8b11e9b9820242ac140005",
            "attributes": {
                "extra_content": {
                    "score": 10
                }
            }
        },
        {
            "type": "exam_question",
            "id": "bce949f2fc8b11e9b9820242ac140005",
            "attributes": {
                "extra_content": {
                    "score": 10
                }
            }
        }
    ]
}

# 参数说明:

参数 参数类型 是否必须 默认值 说明
exam_paper_id string 试卷id
data array 数组个数限制:[1, 500]
data.type string 固定值为 exam_question
data.id string 问题id
data.attributes.extra_content.score int 分值,范围:[1, 1000]

# SDK封装方法使用示例:

$attributes = [
    ["id" => '716995c02c0a11ec9af58a87c47e2012', "score" => 10],
    ["id" => '634dd03c2c0a11ec913d8a87c47e2012', "score" => 10]
];

$Lxapi = new \Lexiangla\Openapi\Api(AppKey, AppSecret);
$response = $Lxapi->patchExamPaperQuestion($staff_id, $attributes, $papers_id);

# 响应

# 204 No Content 状态码
[]

# 删除试卷

# 接口调用说明:

DELETE https://lxapi.lexiangla.com/cgi-bin/v1/exam-papers/{exam_paper_id}

# 参数说明:

参数 参数类型 是否必须 默认值 说明
exam_paper_id string 试卷id

# SDK封装方法使用示例:

$Lxapi = new \Lexiangla\Openapi\Api(AppKey, AppSecret);
$response = $Lxapi->deleteExamPaper($staff_id, $papers_id);

# 响应

# 204 No Content 状态码
[]

# 获取试卷列表

# 接口调用说明:

GET https://lxapi.lexiangla.com/cgi-bin/v1/exam-papers?page=1&per_page=20&team_id={TEAMID}

# 参数说明:

参数 参数类型 是否必须 默认值 说明
page int 1 当前页数
per_page int 20 每页返回的数量
team_id string K吧id

# SDK封装方法使用示例:

$Lxapi = new \Lexiangla\Openapi\Api(AppKey, AppSecret);
$response = $Lxapi->get("exam-papers", [
    "page" => 1,
    "per_page" => 100,
    // "team_id" => "6c55d9b0255111eb82ddd65f6f6227c1"
]);

# 响应document

# 200 OK 状态码
{
    "data": [
        {
            "type": "exam_paper",
            "id": "69a9752eff7211e9821a0242ac140005",
            "attributes": {
                "is_shared": true,
                "title": "保密吧共享",
                "type": "custom"
            }
        },
        {
            "type": "exam_paper",
            "id": "5d8280ecff7211e9b6fe0242ac140005",
            "attributes": {
                "is_shared": false,
                "title": "保密吧私有",
                "type": "custom"
            }
        }
    ],
    "links": {
        "first": "http://lxapi.lx.com/cgi-bin/v1/exam-papers?team_id=ca6d9f220e6c11e99dfb0242ac1b0006&page=1",
        "last": "http://lxapi.lx.com/cgi-bin/v1/exam-papers?team_id=ca6d9f220e6c11e99dfb0242ac1b0006&page=1",
        "prev": null,
        "next": null
    },
    "meta": {
        "current_page": 1,
        "from": 1,
        "last_page": 1,
        "path": "http://lxapi.lx.com/cgi-bin/v1/exam-papers",
        "per_page": 20,
        "to": 2,
        "total": 2
    }
}

# 获取单个试卷

# 接口调用说明:

GET https://lxapi.lexiangla.com/cgi-bin/v1/exam-papers/{exam_paper_id}

# 参数说明:

参数 参数类型 是否必须 默认值 说明
exam_paper_id string 试卷id

# SDK封装方法使用示例:

$Lxapi = new \Lexiangla\Openapi\Api(AppKey, AppSecret);
$response = $Lxapi->get("exam-papers/" . $papers_id); 

# 响应document

# 200 OK 状态码
{
    "data": {
        "type": "exam_paper",
        "id": "3409dad21c5111ec859f0242ac150007",
        "attributes": {
            "is_shared": true,
            "title": "试卷一",
            "type": "custom",
            "created_at": "2021-09-23 17:10:08",
            "extra_content": {}
        },
        "relationships": {
            "owner": {
                "data": {
                    "type": "staff",
                    "id": "zhangsan"
                }
            },
            "team": {
                "data": {
                    "type": "team",
                    "id": "d28191fc6c5411e793520800278acc25"
                }
            },
            "questions": {
                "data": [
                    {
                        "type": "question",
                        "id": "49c588baff7211e9a0480242ac140005"
                    }
                ]
            }
        }
    },
    "included": [
        {
            "type": "staff",
            "id": "zhangsan",
            "attributes": {
                "name": "张三",
                "english_name": "zhangsan",
                "organization": "开发部"
            }
        },
        {
            "type": "team",
            "id": "d28191fc6c5411e793520800278acc25",
            "attributes": {
                "code": "k0001",
                "name": "考试吧",
                "type": 1,
                "logo": null,
                "signature": "",
                "is_secret": 0
            }
        },
        {
            "type": "question",
            "id": "49c588baff7211e9a0480242ac140005",
            "attributes": {
                "title": "题目一",
                "created_at": "2019-11-05 10:16:34",
                "updated_at": "2019-11-05 10:16:34"
            }
        }
    ]
}

# 响应字段说明:

参数 说明
attributes.is_shared 试卷使用范围:0 私密;1 公开
attributes.title 试卷名称
attributes.type 试卷类型:custom 固定试卷;question_lib 随机试卷
attributes.extra_content 当 type=question_lib 时有效,随机试卷的选题策略
attributes.created_at 创建时间
relationships.owner 创建者
relationships.questions 试卷关联的题目
relationships.team 试卷所属K吧
included.staff.organization 所属部门

# 创建题库

# 接口调用说明:

POST https://lxapi.lexiangla.com/cgi-bin/v1/exams/question-libs

# 请求document

{
    "data": {
        "type": "question_lib",
        "attributes": {
            "name": "接口创建题库",
            "is_shared": 0
        }
    }
}

# 参数说明:

参数 参数类型 是否必须 默认值 说明
data.type string 固定值question_lib,表示题库
data.is_shared int 题库使用权限,1表示公开:超级管理员、考试管理员及K吧管理员均可见可用,0表示私密:仅超级管理员、考试管理员可见可用

# SDK封装方法使用示例:

$attributes = [
    "name" => "phpsdk创建",
    "is_shared" => 1
];

$Lxapi = new \Lexiangla\Openapi\Api(AppKey, AppSecret);
$response = $Lxapi->postExamQuestionLib($staff_id, $attributes);

# 响应document

# 201 Created 状态码
{
    "data": {
        "attributes": {
            "updated_at": "2021-09-06 16:08:13",
            "is_shared": 1,
            "name": "接口创建题库",
            "created_at": "2021-09-06 16:08:13"
        },
        "id": "957158c40ee911ecae3da6e815ec777b",
        "type": "question_lib"
    }
}

# 更新题库

# 接口调用说明:

PATCH https://lxapi.lexiangla.com/cgi-bin/v1/exams/question-libs/{question_lib_id}

# 请求document

{
    "data": {
        "type": "question_lib",
        "attributes": {
            "name": "更新题库",
            "is_shared": 0
        }
    }
}

# 参数说明:

参数 参数类型 是否必须 默认值 说明
question_lib_id string 题库id
is_shared int 题库使用权限,1表示公开:超级管理员、考试管理员及K吧管理员均可见可用,0表示私密:仅超级管理员、考试管理员可见可用

# SDK封装方法使用示例:

$attributes = [
    "name" => "phpsdk修改",
    "is_shared" => 0
];;

$Lxapi = new \Lexiangla\Openapi\Api(AppKey, AppSecret);
$response = $Lxapi->patchExamQuestionLib($staff_id, $question_lib_id, $attributes);

# 响应document

# 200 OK 状态码
{
    "data": {
        "attributes": {
            "updated_at": "2021-09-06 16:27:46",
            "is_shared": 0,
            "name": "更新题库",
            "created_at": "2021-09-06 16:08:13"
        },
        "id": "957158c40ee911ecae3da6e815ec777b",
        "type": "question_lib"
    }
}

# 删除题库

# 接口调用说明:

DELETE https://lxapi.lexiangla.com/cgi-bin/v1/exams/question-libs/{question_lib_id}

# 参数说明:

参数 参数类型 是否必须 默认值 说明
question_lib_id string 题库id

# SDK封装方法使用示例:

$Lxapi = new \Lexiangla\Openapi\Api(AppKey, AppSecret);
$response = $Lxapi->deleteExamQuestionLib($staff_id, $question_lib_id);

# 响应document

# 204 No Content 状态码
[]

# 获取题库列表

# 接口调用说明:

GET https://lxapi.lexiangla.com/cgi-bin/v1/exams/question-libs

支持分页参数和排序:(通用说明?

支持时间范围过滤

参数 是否必须 默认值 说明
sort -created_at 排序参数,-created_at支持按题库的降序排序,created_at支持按题库的升序排序
page 1 当前页数
per_page 20 每页返回的数量

# SDK封装方法使用示例:

$Lxapi = new \Lexiangla\Openapi\Api(AppKey, AppSecret);
$response = $Lxapi->get('question-libs', [
    "sort" => '-created_at',
    "page" => '1',
    "per_page" => '20'
]);

# 响应document

# 200 OK 状态码
{
  "data": [
    {
      "type": "question_lib", 
      "id": "91d24592146711ec931a62e1943b6703", 
      "attributes": {
        "is_shared": 0, 
        "name": "交通安全知识", 
        "created_at": "2021-09-13 15:52:40", 
        "updated_at": "2021-09-13 15:52:40", 
        "single_question_count": "8", 
        "multiple_question_count": "2", 
        "judgement_question_count": "6", 
        "fill_question_count": "4", 
        "open_question_count": "2"
      }, 
      "relationships": {
        "owner": {
          "data": {
            "type": "staff", 
            "id": "system-bot"
          }
        }
      }
    }
  ], 
  "links": {
    "first": "https://lxapi.lexiangla.com/cgi-bin/v1/exams/question-libs?per_page=50&page=1", 
    "last": "https://lxapi.lexiangla.com/cgi-bin/v1/exams/question-libs?per_page=50&page=1", 
    "prev": null, 
    "next": null
  }, 
  "meta": {
    "current_page": 1, 
    "from": 1, 
    "last_page": 1, 
    "path": "https://lxapi.lexiangla.com/cgi-bin/v1/exams/question-libs", 
    "per_page": 50, 
    "to": 1, 
    "total": 1
  }, 
  "included": [
    {
      "type": "staff", 
      "id": "system-bot", 
      "attributes": {
        "name": "小秘书", 
        "english_name": null, 
        "organization": null
      }
    }
  ]
}

# 参数说明:

参数 说明
name 题库名称
is_shared 1/0:表示使用权限是否私密
owner 创建者
created_at 创建时间
update_at 更新时间
single_question_count 单选题数
multiple_question_count 多选题数
judgement_question_count 判断题数
fill_question_count 填空题数
open_question_count 问答题数
included.staff.organization 所属部门

# 获取单个题库信息

# 接口调用说明:

GET https://lxapi.lexiangla.com/cgi-bin/v1/exams/question-libs/{question_lib_id}

# SDK封装方法使用示例:

$Lxapi = new \Lexiangla\Openapi\Api(AppKey, AppSecret);
$response = $Lxapi->get('question-libs/fa172aaed87d11ea8e8e622f20de686c');

# 响应document

# 200 OK 状态码
{
    "data": {
        "type": "question_lib",
        "id": "6207884468ec11ebb14a7e25738770c9",
        "attributes": {
            "is_shared": 1,
            "name": "单选题",
            "created_at": "2021-02-07 10:30:03",
            "updated_at": "2021-02-07 10:30:03"
        },
        "relationships": {
            "owner": {
                "data": {
                    "type": "staff",
                    "id": "ThreeZhang"
                }
            },
            "team": {
                "data": {
                    "type": "team",
                    "id": "e9c53e7a5c8511ebb2f21213bcbfe91b"
                }
            }
        }
    },
    "included": [
        {
            "type": "staff",
            "id": "ThreeZhang",
            "attributes": {
                "name": "张三",
                "english_name": null,
                "organization": "开发部"
            }
        },
        {
            "type": "team",
            "id": "e9c53e7a5c8511ebb2f21213bcbfe91b",
            "attributes": {
                "code": "k100983",
                "name": "素材",
                "type": 2,
                "signature": "",
                "is_secret": 1
            }
        }
    ]
}

# 参数说明:

参数 说明
name 题库名称
is_shared 1/0:表示使用权限是否私密
owner 创建者
created_at 创建时间
update_at 更新时间
included.staff.organization 所属部门

# 创建题目

# 接口调用说明:

POST https://lxapi.lexiangla.com/cgi-bin/v1/exams/question-libs/{question_lib_id}/questions

# 请求document

单选题

{
    "data": {
        "type": "exam_question",
        "attributes": {
            "question_type": "single",
            "question_content": {
                "title": "以下哪个是国内的名著?",
                "video_info": {
                    "serverData": {
                        "id": "55e540a2ebb611eda516c217dbf23xxx" 
                    }
                },
                "picture_url":"https://abc.lexiangla.com/assets/bad1a31cebb511ed8467c217dbf2337b",
                "choices": [
                    {
                        "flag": "A",
                        "content": "三国演义",
                        "picture_url": "http://www.yuwenmi.com/pic/original/copyright/img/c8fdb9fad1ddd2e53_2.jpg"
                    },
                    {
                        "flag": "B",
                        "content": "哈利波特",
                        "picture_url": "https://news.cts.com.tw/photo/cts/201909/201909041973614_l.jpg"
                    }
                ]
            },
            "answer_content": {
                "expect": "A",
                "analysis": "这都不知道就说不过去了",
                "analysis_url": "https://zh.wikipedia.org/wiki/%E5%9B%9B%E5%A4%A7%E5%90%8D%E8%91%97"
            }
        }
    }
}

多选题

{
    "data": {
        "type": "exam_question",
        "attributes": {
            "question_type": "multiple",
            "question_content": {
                "title": "以下哪个不是四大名著?",
                "video_info": {
                    "serverData": {
                        "id": "55e540a2ebb611eda516c217dbf23xxx" 
                    }
                },
                "picture_url":"https://abc.lexiangla.com/assets/bad1a31cebb511ed8467c217dbf2337b",
                "choices": [
                    {
                        "flag": "A",
                        "content": "神雕侠侣",
                        "picture_url": "https://www.abc.com/fs/img/cd/cdf2a4159459f4f4dbbaddc25610f961.jpg"
                    },
                    {
                        "flag": "B",
                        "content": "哈利波特",
                        "picture_url": "https://news.cts.com.tw/photo/cts/201909/201909041973614_l.jpg"
                    }
                ]
            },
            "answer_content": {
                "expect": ["A", "B"],
                "analysis": "这都不知道就说不过去了",
                "analysis_url": "https://zh.wikipedia.org/wiki/%E5%9B%9B%E5%A4%A7%E5%90%8D%E8%91%97"
            }
        }
    }
}

判断题

{
    "data": {
        "type": "exam_question", 
        "attributes": {
            "question_type": "judgement", 
            "question_content": {
                "title": "红楼梦是四大名著?", 
                "video_info": {
                    "serverData": {
                        "id": "55e540a2ebb611eda516c217dbf23xxx"
                    }
                }, 
                "picture_url": "https://abc.lexiangla.com/assets/bad1a31cebb511ed8467c217dbf2337b", 
                "choices": [
                    {
                        "flag": "A", 
                        "content": "对"
                    }, 
                    {
                        "flag": "B", 
                        "content": "错"
                    }
                ]
            }, 
            "answer_content": {
                "expect": "A", 
                "analysis": "这都不知道就说不过去了", 
                "analysis_url": "https://zh.wikipedia.org/wiki/%E5%9B%9B%E5%A4%A7%E5%90%8D%E8%91%97"
            }
        }
    }
}

填空题

{
    "data": {
        "type": "exam_question",
        "attributes": {
            "question_type": "fill",
            "question_content": {
                "title": "四大名著是___, ___, ___, ___",
                "video_info": {
                    "serverData": {
                        "id": "55e540a2ebb611eda516c217dbf23xxx"
                    }
                }, 
                "picture_url": "https://abc.lexiangla.com/assets/bad1a31cebb511ed8467c217dbf2337b",
                "fill_count": 4
            },
            "answer_content": {
                "expect": ["水浒传", "西游记", "三国演义", "红楼梦"],
                "free_sort": 1,
                "analysis": "这都不知道就说不过去了",
                "analysis_url": "https://zh.wikipedia.org/wiki/%E5%9B%9B%E5%A4%A7%E5%90%8D%E8%91%97"
            }
        }
    }
}

问答题

{
    "data": {
        "type": "exam_question",
        "attributes": {
            "question_type": "open",
            "question_content": {
                "title": "评价一下四大名著的影响?"
                "video_info": {
                    "serverData": {
                        "id": "55e540a2ebb611eda516c217dbf23xxx"
                    }
                }, 
                "picture_url": "https://abc.lexiangla.com/assets/bad1a31cebb511ed8467c217dbf2337b"
            },
            "answer_content": {
                "keyword": "水浒传; 西游记; 三国演义; 红楼梦",
                "analysis": "这都不知道就说不过去了",
                "analysis_url": "https://zh.wikipedia.org/wiki/%E5%9B%9B%E5%A4%A7%E5%90%8D%E8%91%97"
            }
        }
    }
}

# 参数说明:

参数 参数类型 是否必须 默认值 说明
question_lib_id string 题库ID,表示题目发表在哪个题库下
type string 资源对象类型,必须为 exam_question,表示考试题目
title string 题目的标题,方便用于搜索和列表展示,不用于实际试卷生成,但应与question_contenttitle字段保持一致
question_type string 题目类型:single 表示单选题,multiple 表示多选题,judgement表示判断题,fill表示填空题,open表示问答题
question_content object 题目内容,根据question_type不同,有不同的结构,详细参数参照下方说明
answer_content object 答案内容,根据question_type不同,有不同的结构,详细参数参照下方说明

question_content参数说明:

参数 参数类型 支持题型 说明
title string 所有题型 题目的标题,题型为填空题时,连续3个_(下划线)表示一个空
video_info object 所有题型 题目的标题要展示的视频,视频id从 创建视频实体时获取
picture_url object 所有题型 题目的标题要展示的图片
choices array 单选、多选、判断题 选项数组,每个choice参数配置参考下方说明
fill_count int 填空题 选项数组

choice参数说明:

参数 参数类型 是否必须 默认值 说明
flag string 选项索引,建议使用"A"、"B"、"C"、"D"……判断题只支持2个选项
content string 选项答案。判断题只支持“对”与“错
picture_url string 选项答案要展示图片时,设置图片地址。

answer_content参数说明:

参数 参数类型 支持题型 说明
expect mix 单选、多选、判断、填空题 单选和判断用string,多选和填空用array
keyword array 开放题 答案得分关键词
free_sort bool 填空题 是否允许答题与答案顺序不一致
analysis string 所有题型 答案解析
analysis_url string 所有题型 答案链接

# SDK封装方法使用示例:

单选题

//创建题目-单选

$attributes = [
    "question_type" => "single",
    "question_content" => [
        "title" => "以下哪个是国内的名著?-sdk单选题",
        "choices" => [
            [
                "flag" => "A",
                "content" => "三国演义",
                "picture_url" => "http://www.yuwenmi.com/pic/original/copyright/img/c8fdb9fad1ddd2e53_2.jpg"
            ],
            [
                "flag" => "B",
                "content" => "哈利波特",
                "picture_url" => "https://news.cts.com.tw/photo/cts/201909/201909041973614_l.jpg"
            ]
        ]
    ],
    "answer_content" => [
        "expect" => "A",
        "analysis" => "答案解析",
        "analysis_url" => "https://zh.wikipedia.org/wiki/%E5%9B%9B%E5%A4%A7%E5%90%8D%E8%91%97"
    ]
];

$Lxapi = new \Lexiangla\Openapi\Api(AppKey, AppSecret);
$response = $Lxapi->postExamQuestion($staff_id, $question_lib_id, $attributes);

多选题

//创建题目-多选

$attributes = [
    "question_type" => "multiple",
    "question_content" => [
        "title" => "以下哪个不是四大名著?-sdk多选题",
        "choices" => [
            [
                "flag" => "A",
                "content" => "神雕侠侣",
                "picture_url" => "https://www.laoziliao.com/fs/img/cd/cdf2a4159459f4f4dbbaddc25610f961.jpg"
            ],
            [
                "flag" => "B",
                "content" => "哈利波特",
                "picture_url" => "https://news.cts.com.tw/photo/cts/201909/201909041973614_l.jpg"
            ]
        ]
    ],
    "answer_content" => [
        "expect" => ["A", "B"],
        "analysis" => "答案解析",
        "analysis_url" => "https://zh.wikipedia.org/wiki/%E5%9B%9B%E5%A4%A7%E5%90%8D%E8%91%97"
    ]
];

$Lxapi = new \Lexiangla\Openapi\Api(AppKey, AppSecret);
$response = $Lxapi->postExamQuestion($staff_id, $question_lib_id, $attributes);

判断题

//创建题目-判断

$attributes = [
    "question_type" => "judgement",
    "question_content" => [
        "title" => "红楼梦是四大名著?-sdk判断题",
        "choices" => [
            [
                "flag" => "A",
                "content" => "对"
            ],
            [
                "flag" => "B",
                "content" => "错"
            ]
        ]
    ],
    "answer_content" => [
        "expect" => "A",
        "analysis" => "答案解析",
        "analysis_url" => "https://zh.wikipedia.org/wiki/%E5%9B%9B%E5%A4%A7%E5%90%8D%E8%91%97"
    ]
];

$Lxapi = new \Lexiangla\Openapi\Api(AppKey, AppSecret);
$response = $Lxapi->postExamQuestion($staff_id, $question_lib_id, $attributes);

填空题

//创建题目-填空题

$attributes = [
    "question_type" => "fill",
    "question_content" => [
        "title" => "四大名著是___, ___, ___, ___ -sdk填空题",
        "fill_count" => 4
    ],
    "answer_content" => [
        "expect" => ["水浒传", "西游记", "三国演义", "红楼梦"],
        "free_sort" => true,//是否允许答题与答案顺序不一致
        "analysis" => "答案解析",
        "analysis_url" => "https://zh.wikipedia.org/wiki/%E5%9B%9B%E5%A4%A7%E5%90%8D%E8%91%97"
    ]
];

$Lxapi = new \Lexiangla\Openapi\Api(AppKey, AppSecret);
$response = $Lxapi->postExamQuestion($staff_id, $question_lib_id, $attributes);

问答题

//创建题目-问答题

$attributes = [
    "question_type" => "open",
    "question_content" => [
        "title" => "评价一下四大名著的影响? -sdk问答题",
    ],
    "answer_content" => [
        "keyword" => "水浒传; 西游记; 三国演义; 红楼梦",
        "analysis" => "答案解析",
        "analysis_url" => "https://zh.wikipedia.org/wiki/%E5%9B%9B%E5%A4%A7%E5%90%8D%E8%91%97"
    ]
];

$Lxapi = new \Lexiangla\Openapi\Api(AppKey, AppSecret);
$response = $Lxapi->postExamQuestion($staff_id, $question_lib_id, $attributes);

# 响应document

# 201 Created 状态码
{
    "data": {
        "attributes": {
            "answer_content": {
                "keyword": [
                    "水浒传",
                    "西游记",
                    "三国演义",
                    "红楼梦"
                ],
                "analysis": "这都不知道就说不过去了",
                "analysis_url": "https://zh.wikipedia.org/wiki/%E5%9B%9B%E5%A4%A7%E5%90%8D%E8%91%97"
            },
            "question_type": "open",
            "question_content": {
                "title": "评价一下四大名著的影响?"
            }
        },
        "id": "29bd5e72093d11ecbda41e5e2b4aa415",
        "type": "exam_question"
    }
}

# 更新题库题目

# 接口调用说明:

PATCH https://lxapi.lexiangla.com/cgi-bin/v1/exams/question-libs/{question_lib_id}/questions/{question_id}

更新单选题

{
    "data": {
        "type": "exam_question",
        "attributes": {
            "question_content": {
                "title": "以下哪个是四大名著???",
                "choices": [
                    {
                        "flag": "A",
                        "content": "三国演义",
                        "picture_url": "http://www.yuwenmi.com/pic/original/copyright/img/c8fdb9fad1ddd2e53_2.jpg"
                    },
                    {
                        "flag": "B",
                        "content": "哈利波特",
                        "picture_url": "https://news.cts.com.tw/photo/cts/201909/201909041973614_l.jpg"
                    },
                    {
                        "flag": "C",
                        "content": "小王子"
                    }
                ]
            },
            "answer_content": {
                "expect": "A",
                "analysis": "这都不知道就说不过去了"
            }
        }
    }
}

# 参数说明

参数 参数类型 是否必须 默认值 说明
question_lib_id string 题库id,表示题目发表在哪个题库下
question_id string 题目id
type string 资源对象类型,必须为 exam_question,表示考试题目
title string 题目的标题,方便用于搜索和列表展示,不用于实际试卷生成,但应与question_contenttitle字段保持一致

# SDK封装方法使用示例:

$attributes = [
    "question_content" => [
        "title" => "以下哪个不是四大名著?",
        "choices" => [
            [
                "flag" => "A",
                "content" => "神雕侠侣",
                "picture_url" => "https://www.laoziliao.com/fs/img/cd/cdf2a4159459f4f4dbbaddc25610f961.jpg"
            ],
            [
                "flag" => "B",
                "content" => "哈利波特",
                "picture_url" => "https://news.cts.com.tw/photo/cts/201909/201909041973614_l.jpg"
            ],
            [
                "flag" => "C",
                "content" => "小王子"
            ]
        ]
    ],
    "answer_content" => [
        "expect" => "A",
        "analysis" => "答案解析",
    ]
];

$Lxapi = new \Lexiangla\Openapi\Api(AppKey, AppSecret);
$response = $Lxapi->patchExamQuestion($staff_id, $question_lib_id, $question_id, $attributes);

# 响应document

# 200 OK 状态码
{
    "data": {
        "relationships": {
            "question_lib": {
                "data": {
                    "id": "a813226c071611eca8819e0dcb050763",
                    "type": "question_lib"
                }
            }
        },
        "attributes": {
            "answer_content": {
                "expect": "A",
                "analysis": "这都不知道就说不过去了"
            },
            "question_type": "single",
            "question_content": {
                "title": "以下哪个是四大名著???",
                "choices": [
                    {
                        "flag": "A",
                        "picture_url": "http://www.yuwenmi.com/pic/original/copyright/img/c8fdb9fad1ddd2e53_2.jpg",
                        "content": "三国演义"
                    },
                    {
                        "flag": "B",
                        "picture_url": "https://news.cts.com.tw/photo/cts/201909/201909041973614_l.jpg",
                        "content": "哈利波特"
                    },
                    {
                        "flag": "C",
                        "content": "小王子"
                    }
                ]
            }
        },
        "id": "28ba64ca093d11eca72a320d2be40469",
        "type": "exam_question"
    },
    "included": [
        {
            "attributes": {
                "updated_at": "2021-08-30 11:41:35",
                "is_shared": 0,
                "name": "K吧创建题库",
                "created_at": "2021-08-27 17:10:43"
            },
            "id": "a813226c071611eca8819e0dcb050763",
            "type": "question_lib"
        }
    ]
}

# 删除题库题目

# 接口调用说明:

DELETE https://lxapi.lexiangla.com/cgi-bin/v1/exams/question-libs/{question_lib_id}/questions/{question_id}

# 参数说明

参数 参数类型 是否必须 默认值 说明
question_lib_id string 题库id,表示题目发表在哪个题库下
question_id string 题目id

# SDK封装方法使用示例:

$Lxapi = new \Lexiangla\Openapi\Api(AppKey, AppSecret);
$response = $Lxapi->deleteExamQuestion($staff_id, $question_lib_id, $question_id);

# 响应document

# 204 No Content 状态码
[]

# 获取题库题目列表

# 接口调用说明:

GET https://lxapi.lexiangla.com/cgi-bin/v1/exams/question-libs/{question_lib_id}/questions

# 参数说明

参数 参数类型 是否必须 默认值 说明
question_lib_id string 题库id,表示题目发表在哪个题库下

# SDK封装方法使用示例:

$Lxapi = new \Lexiangla\Openapi\Api(AppKey, AppSecret);
$response = $Lxapi->get("/exams/question-libs/" . $question_lib_id . "/questions");

# 响应document

# 200 OK 状态码
{
    "data": [
        {
            "attributes": {
                "answer_content": {
                    "expect": "A",
                    "analysis": "这都不知道就说不过去了",
                    "analysis_url": "https://zh.wikipedia.org/wiki/%E5%9B%9B%E5%A4%A7%E5%90%8D%E8%91%97"
                },
                "question_type": "judgement",
                "question_content": {
                    "title": "红楼梦是四大名著?",
                    "choices": [
                        {
                            "flag": "A",
                            "content": "对"
                        },
                        {
                            "flag": "B",
                            "content": "错"
                        }
                    ]
                }
            },
            "id": "2930d38a093d11ec8d38927a04b63305",
            "type": "exam_question"
        },
        {
            "attributes": {
                "answer_content": {
                    "expect": [
                        "水浒传",
                        "西游记",
                        "三国演义",
                        "红楼梦"
                    ],
                    "free_sort": true,
                    "analysis": "这都不知道就说不过去了",
                    "analysis_url": "http://image.uc.cn/s/wemedia/s/upload/2020/7610c8cf03210c13fd648a6afadb1268.jpg"
                },
                "question_type": "fill",
                "question_content": {
                    "fill_count": 4,
                    "title": "四大名著是___, ___, ___, ___"
                }
            },
            "id": "29743454093d11ec869b1e5e2b4aa415",
            "type": "exam_question"
        },
        {
            "attributes": {
                "answer_content": {
                    "keyword": [
                        "水浒传",
                        "西游记",
                        "三国演义",
                        "红楼梦"
                    ],
                    "analysis": "这都不知道就说不过去了",
                    "analysis_url": "https://zh.wikipedia.org/wiki/%E5%9B%9B%E5%A4%A7%E5%90%8D%E8%91%97"
                },
                "question_type": "open",
                "question_content": {
                    "title": "评价一下四大名著的影响?"
                }
            },
            "id": "29bd5e72093d11ecbda41e5e2b4aa415",
            "type": "exam_question"
        },
        {
            "attributes": {
                "answer_content": {
                    "expect": "A",
                    "analysis": "这都不知道就说不过去了"
                },
                "question_type": "single",
                "question_content": {
                    "title": "以下哪个是四大名著???",
                    "choices": [
                        {
                            "flag": "A",
                            "picture_url": "http://www.yuwenmi.com/pic/original/copyright/img/c8fdb9fad1ddd2e53_2.jpg",
                            "content": "三国演义"
                        },
                        {
                            "flag": "B",
                            "picture_url": "https://news.cts.com.tw/photo/cts/201909/201909041973614_l.jpg",
                            "content": "哈利波特"
                        },
                        {
                            "flag": "C",
                            "content": "小王子"
                        }
                    ]
                }
            },
            "id": "28ba64ca093d11eca72a320d2be40469",
            "type": "exam_question"
        },
        {
            "attributes": {
                "answer_content": {
                    "expect": [
                        "A",
                        "B"
                    ],
                    "analysis": "这都不知道就说不过去了",
                    "analysis_url": "https://zh.wikipedia.org/wiki/%E5%9B%9B%E5%A4%A7%E5%90%8D%E8%91%97"
                },
                "question_type": "multiple",
                "question_content": {
                    "title": "以下哪个不是四大名著?",
                    "choices": [
                        {
                            "flag": "A",
                            "picture_url": "https://www.laoziliao.net/fs/img/cd/cdf2a4159459f4f4dbbaddc25610f961.jpg",
                            "content": "神雕侠侣"
                        },
                        {
                            "flag": "B",
                            "picture_url": "https://news.cts.com.tw/photo/cts/201909/201909041973614_l.jpg",
                            "content": "哈利波特"
                        }
                    ]
                }
            },
            "id": "28f97d22093d11ecb6ee320d2be40469",
            "type": "exam_question"
        }
    ],
    "meta": {
        "path": "https://lxapi.lexiangla.com/cgi-bin/v1/exams/question-libs/a813226c071611eca8819e0dcb050763/questions",
        "per_page": 20,
        "total": 5,
        "last_page": 1,
        "from": 1,
        "to": 5,
        "current_page": 1
    },
    "links": {
        "next": null,
        "last": "https://lxapi.lexiangla.com/cgi-bin/v1/exams/question-libs/a813226c071611eca8819e0dcb050763/questions?page=1",
        "prev": null,
        "first": "https://lxapi.lexiangla.com/cgi-bin/v1/exams/question-libs/a813226c071611eca8819e0dcb050763/questions?page=1"
    }
}

# 获取单个题目信息(旧)

# 接口调用说明:

GET https://lxapi.lexiangla.com/cgi-bin/v1/exams/question-libs/{question_lib_id}/questions/{question_id}

# 参数说明

参数 参数类型 是否必须 默认值 说明
question_lib_id string 题库id
question_id string 题目id

# SDK封装方法使用示例:

$Lxapi = new \Lexiangla\Openapi\Api(AppKey, AppSecret);
$response = $Lxapi->get("exams/question-libs/" . $question_lib_id . "/questions/" . $question_id);

# 响应document

# 200 OK 状态码
{
    "data": {
        "attributes": {
            "answer_content": {
                "expect": "A",
                "free_sort": 0,
                "keyword": null,
                "analysis": "",
                "analysis_url": ""
            },
            "updated_at": "2021-10-13 09:48:46",
            "question_type": "single",
            "question_content": {
                "picture_url": "",
                "choices": [
                    {
                        "flag": "A",
                        "picture_url": "",
                        "content": "红楼梦"
                    },
                    {
                        "flag": "B",
                        "picture_url": "",
                        "content": "假如给我三天光明"
                    },
                    {
                        "flag": "C",
                        "content": "鲁宾逊漂流记"
                    }
                ],
                "title": "以下那个是中国的四大名著?"
            },
            "created_at": "2021-10-13 09:48:46"
        },
        "id": "b46506042bc711ec8dd646620ea32cb3",
        "type": "exam_question"
    }
}

# 参数说明

参数 说明
answer_content 答案内容
analysis_url 答案链接
question_type 题目类型
question_content 题目内容
picture_url 选项答案要展示图片时,设置图片地址。
choices 选项数组
flag 选项索引
title 标题
id 题目id

# 获取单个题目信息(新)

# 接口调用说明:

GET https://lxapi.lexiangla.com/cgi-bin/v1/exams/questions/{question_id}

# 参数说明

参数 参数类型 是否必须 默认值 说明
question_id string 题目id

# 响应document

# 200 OK 状态码
{
    "data": {
        "attributes": {
            "answer_content": {
                "expect": "A",
                "free_sort": 0,
                "keyword": null,
                "analysis": "",
                "analysis_url": ""
            },
            "updated_at": "2021-10-13 09:48:46",
            "question_type": "single",
            "question_content": {
                "picture_url": "",
                "choices": [
                    {
                        "flag": "A",
                        "picture_url": "",
                        "content": "红楼梦"
                    },
                    {
                        "flag": "B",
                        "picture_url": "",
                        "content": "假如给我三天光明"
                    },
                    {
                        "flag": "C",
                        "content": "鲁宾逊漂流记"
                    }
                ],
                "title": "以下那个是中国的四大名著?"
            },
            "created_at": "2021-10-13 09:48:46"
        },
        "id": "b46506042bc711ec8dd646620ea32cb3",
        "type": "exam_question"
    }
}

# 参数说明

参数 说明
answer_content 答案内容
analysis_url 答案链接
question_type 题目类型
question_content 题目内容
picture_url 选项答案要展示图片时,设置图片地址。
choices 选项数组
flag 选项索引
title 标题
id 题目id