GET https://lxapi.lexiangla.com/cgi-bin/v1/certificates
支持分页参数和排序:(通用说明?)
支持时间范围过滤
参数 | 是否必须 | 默认值 | 说明 |
---|---|---|---|
page | 否 | 1 | 当前页数 |
per_page | 否 | 20 | 每页返回的数量 |
$Lxapi = new \Lexiangla\Openapi\Api(AppKey, AppSecret);
$response = $Lxapi->get('certificates');
document
{
"data": [
{
"type": "certificate",
"id": 1,
"attributes": {
"title": "证书标题XXX",
"code_fixed": "LEXIANG",
"code_weight": 5,
"total_num": 1000,
"period": 0,
"created_at": "2020-06-10 19:50:40",
"updated_at": "2020-06-29 09:56:52",
"preview": "https://lexiangla.com/assets/977ddbbcab1011eaa04f6a8434ce557c",
"valid_num": 998
},
"relationships": {
"owner": {
"data": {
"type": "staff",
"id": "ThreeZhang"
}
}
}
}
],
"links": {
"first": "https://lxapi.lexiangla.com/cgi-bin/v1/certificates?page=1",
"last": "https://lxapi.lexiangla.com/cgi-bin/v1/certificates?page=10",
"prev": null,
"next": "https://lxapi.lexiangla.com/cgi-bin/v1/certificates?page=2"
},
"meta": {
"current_page": 1,
"from": 1,
"last_page": 10,
"path": "https://lxapi.lexiangla.com/cgi-bin/v1/certificates",
"per_page": 20,
"to": 20,
"total": 184
},
"included": [
{
"type": "staff",
"id": "ThreeZhang",
"attributes": {
"name": "ThreeZhang",
"english_name": null,
"organization": "乐享平台中心"
}
}
]
}
参数 | 说明 |
---|---|
title | 证书标题 |
code_fixed | 证书固定编号 |
code_weight | 证书编号位数 |
total_num | 证书颁发总数 |
valid_num | 证书有效数量 |
period | 证书有效期 |
preview | 证书预览图 |
GET https://lxapi.lexiangla.com/cgi-bin/v1/staffs/{staff_id}/certificate-rewards
参数 | 是否必须 | 默认值 | 说明 |
---|---|---|---|
staff_id | 是 | 无 | 要获取证书详情的员工帐号 |
start_time | 否 | 无 | 颁发证书开始时间 格式:2022-02-20 18:00:00 |
end_time | 否 | 无 | 颁发证书结束时间 格式:2022-06-20 18:00:00 |
status | 否 | 无 | 证书状态 valid :有效;expiration :已过期;all 和不传参:有效+已过期; |
$Lxapi = new \Lexiangla\Openapi\Api(AppKey, AppSecret);
$response = $Lxapi->get("staffs/" . $staff_id . "/certificate-rewards");
document
{
"data": [
{
"type": "certificate_reward",
"id": "6ecc467e1a4b11ee81638aa24f7b6c47",
"attributes": {
"title": "证书1",
"code": "ZSSSSSSSSCFqGc07oi",
"source": "admin",
"created_at": "2023-07-04 17:16:17",
"image": "https://abc.lexiangla.com/assets/719119f21a4b11eea4288aa24f7b6cxx",
"status": "有效",
"expired_at": "永久",
"source_text": "管理后台"
},
"relationships": {
"certificate": {
"data": {
"type": "certificate",
"id": 409
}
}
}
},
{
"type": "certificate_reward",
"id": "242c17f21a4b11ee80b18aa24f7b6c47",
"attributes": {
"title": "证书2",
"code": "ZSSSSSSSSwB0Sz6Euu",
"source": "admin",
"created_at": "2023-07-04 17:14:12",
"image": "https://abc.lexiangla.com/assets/26f185301a4b11eeae9e8aa24f7b6cxx",
"status": "有效",
"expired_at": "永久",
"source_text": "管理后台"
},
"relationships": {
"certificate": {
"data": {
"type": "certificate",
"id": 409
}
}
}
}
],
"links": {
"first": "https://lxapi.lexiangla.com/cgi-bin/v1/staffs/v_adandxu/certificate-rewards?per_page=2&page=1",
"last": "https://lxapi.lexiangla.com/cgi-bin/v1/staffs/v_adandxu/certificate-rewards?per_page=2&page=14",
"prev": null,
"next": "https://lxapi.lexiangla.com/cgi-bin/v1/staffs/v_adandxu/certificate-rewards?per_page=2&page=2"
},
"meta": {
"current_page": 1,
"from": 1,
"last_page": 14,
"path": "https://lxapi.lexiangla.com/cgi-bin/v1/staffs/v_adandxu/certificate-rewards",
"per_page": 2,
"to": 2,
"total": 28
},
"included": [
{
"type": "certificate",
"id": 409,
"attributes": {
"title": "主证书",
"code_fixed": "ZSSSSSSSS",
"code_weight": 9,
"total_num": 14,
"period": 0,
"created_at": "2023-04-12 16:54:51",
"updated_at": "2023-07-14 16:24:52",
"preview": "https://abc.lexiangla.com/assets/b97e3f66f0a111ed94414a3a983d6374",
"valid_num": "13"
}
}
]
}
参数 | 说明 |
---|---|
data.type | 资源对象类型,为certificate_reward,表示资源为证书 |
attributes.title | 证书标题 |
attributes.code | 证书完整编号 |
attributes.source | 证书颁发来源 admin:管理后台 class:课堂应用 learning:学习地图应用 exam:考试应用 |
attributes.created_at | 证书创建日期 |
attributes.image | 证书图片 |
attributes.status | 证书状态 |
attributes.expired_at | 证书有效期 |
attributes.source_text | 证书颁发来源中文标识 |
GET https://lxapi.lexiangla.com/cgi-bin/v1/certificates/{certificate_id}/rewards
$Lxapi = new \Lexiangla\Openapi\Api(AppKey, AppSecret);
$response = $Lxapi->get('certificates/10/rewards');
document
{
"data": [
{
"type": "certificate_reward",
"id": "c1fd844ec4c211e99cf30a58ac1304e4",
"attributes": {
"title": "2019十佳销售精英",
"code": "LEXIANG1000001",
"image": "https://lexiangla.com/assets/c34d4a46c4c211e9bde60a58ac1304e4",
"created_by": "ThreeZhang",
"deleted_at": null,
"created_at": "2019-08-22 17:53:56",
"updated_at": "2019-08-22 17:53:59",
"status": "有效",
"expired_at": "2024-04-22",
"source_text": "管理后台"
},
"relationships": {
"owner": {
"data": {
"type": "staff",
"id": "ThreeZhang"
}
}
}
}
],
"links": {
"first": "https://lxapi.lexiangla.com/cgi-bin/v1/certificates/10/rewards?page=1",
"last": "https://lxapi.lexiangla.com/cgi-bin/v1/certificates/10/rewards?page=155",
"prev": null,
"next": "https://lxapi.lexiangla.com/cgi-bin/v1/certificates/10/rewards?page=2"
},
"meta": {
"current_page": 1,
"from": 1,
"last_page": 155,
"path": "https://lxapi.lexiangla.com/cgi-bin/v1/certificates/10/rewards",
"per_page": 20,
"to": 20,
"total": 3095
},
"included": [
{
"type": "staff",
"id": "ThreeZhang",
"attributes": {
"name": "ThreeZhang",
"english_name": null,
"organization": "开发组 "
}
}
]
}
参数 | 说明 |
---|---|
title | 证书标题 |
code | 证书完整编号 |
image | 证书图片 |
status | 证书状态 |
expired_at | 证书有效期 |
source | 证书颁发来源 admin:管理后台 class:课堂应用 learning:学习地图应用 exam:考试应用 |
source_text | 证书颁发来源中文标识 |
POST https://lxapi.lexiangla.com/cgi-bin/v1/certificates/{certificate_id}/rewards
document
{
"data": {
"type": "certificate_reward",
"attributes": {
"is_notify": 1
},
"relationships":{
"recipient":{
"data":{
"type":"staff",
"id":"ThreeZhang"
}
}
}
}
}
参数 | 是否必须 | 默认值 | 说明 |
---|---|---|---|
certificate_id | 是 | 无 | 资源对象类型为 certificate_reward 的资源对象id,即证书模板的id |
type | 是 | 无 | 资源对象类型,必须为 certificate_reward,表示问题 |
certificate_reward.is_notify | 是 | 0 | 是否发送通知; 1 是 0 否 |
certificate_reward.recipient | 是 | 无 | 关联的资源对象,类型为staff ,表示被颁发证书的员工 |
$attributes = [
"is_notify" => true,
"staff_id" => 'ThreeZhang',
];
$Lxapi = new \Lexiangla\Openapi\Api(AppKey, AppSecret);
$response = $Lxapi->postCertificateReward(StaffID, certificate_id, $attributes);
document
证书颁发是异步任务,接口调用成功会立即返回 204 状态码,没有具体响应内容。
DELETE https://lxapi.lexiangla.com/cgi-bin/v1/certificates/{certificate_id}/rewards?code={code}
参数 | 是否必须 | 默认值 | 说明 |
---|---|---|---|
certificate_id | 是 | 无 | 资源对象类型为 certificate_reward 的资源对象 id,即证书模板的 id |
code | 是 | 无 | 颁发证书的编号 |
$Lxapi = new \Lexiangla\Openapi\Api(AppKey, AppSecret);
$response = $Lxapi->deleteCertificateReward(StaffID, certificate_id, '51Npuf');
document
接口调用成功会立即返回 204 状态码,没有具体响应内容。