[关闭]
@sewise-dev 2018-07-31T08:04:50.000000Z 字数 14246 阅读 595

知识元接口文档(整理)

知识元


更新历史

编号 版本 说明 作者 日期
1 v1.0 1.创建文档 Seven 2018-07-31


目录


1.知识元接口定义(node版)

1.7 获取课时拼接的m3u8播放地址

接口地址

/m3u8/preview

HTTP Content-Type / 请求方式

application/json
POST

请求参数
参数 必选 类型 说明
RequestBody
predata jsonArray 预览的资源数组,包含开始和结束时间
predata拆解
参数 必选 类型 说明
payload
filePath String 资源地址
startTime Int 开始时间(字节数)
endTime Int 结束时间(字节数)

例:
predata: [{"filePath":"/resource/0fe993407a35c3c014f934c10ec65d9c","startTime":1752,"endTime":80872},{"filePath":"/resource/0fe993407a35c3c014f934c10ec65d9c","startTime":80872,"endTime":146271}]

HTTP 响应状态

200

返回字段 字段类型 说明
status int 返回状态码
message String 返回错误信息
data Array 返回结果
接口示例

Response
{"success":true,"path":"/storage/swlsource/m3u8/cs/62e66f7e31b051e02865b933a11ac44c.m3u8","duration":144519}

1.8 获取问答详情

接口地址

/question/title?topic_id={topic_id}

HTTP Content-Type / 请求方式

application/json
GET

请求参数
参数 必选 类型 说明
RequestBody
topic_id String 问答题的topic_id

例:
topic_id: 65ac5c3e-e73d-4427-a969-627cb34be095

HTTP 响应状态

200

返回字段 字段类型 说明
status int 返回状态码
message String 返回错误信息
data Array 返回结果
接口示例

Response
{"success":true,"data":[{"_id":"5b60017c6fb89d67ec0653ad","topic_id":"65ac5c3e-e73d-4427-a969-627cb34be095","creator_uid":"2","question":"9*9=?","option":["9","18","81","108"],"answer":[2],"type":"single","create_time":"2018-07-31 14:28:12","from":"","hide":0}]}

1.9 获取pdf缩率图

接口地址

/img/{hashid}?page={page}

HTTP Content-Type / 请求方式

application/json
GET

请求参数
参数 必选 类型 说明
RequestBody
hashid String pdf文件的hashid
page Int 访问第几页pdf,默认1

例:
/img/8383558c1f7cd7b840b97ea1385f3be1?page=1

HTTP 响应状态

200

返回字段 字段类型 说明
status int 返回状态码
message String 返回错误信息
data Array 返回结果

1.11 获取微录播在线消息

接口地址

/host?userInfo={userInfo}

HTTP Content-Type / 请求方式

application/json
GET

请求参数
参数 必选 类型 说明
RequestBody
userInfo String 用户信息

例:
userInfo: {"userId":"2","username":"2","mobile":"18675577003","userType":"2","vip":"0","creationDate":"2018-07-25 18:25:06","accountStatus":"1","expertRank":"0","lastLogin":"2018-07-31 14:04:36","isDelete":"N","from":null,"expireDate":null,"access_token":"7Ji9PsFlHK8YHpPoJ6RtYvrAZ1O8YRRZGo779co7","sn":"org_1_0_0_0_0","organId":"1","organName":"品酒师","address":"深圳","nickName":"18675577003","nickname":"18675577003","avatar":"","role":"1","accountname":"18675577003","admin":0,"network":"out","nrp_url":".nrppjs.sewise.com"}

HTTP 响应状态

200

返回字段 字段类型 说明
status int 返回状态码
message String 返回错误信息
data Array 返回结果
接口示例

Response
{"success":true,"data":{"nodeId":"1","nodeSn":"SP05AV100034711A","nodeName":"品酒师","nodeIp":"192.168.1.114","nodeHost":"http://sp05av100034711a.nrppjs.sewise.com","province":"440000","city":"440300","area":"440305","organKind":"5","typeId":null,"classId":null,"modifiedDate":"2018-07-31 10:19:45","typeKind":"2"}}

1.12 提交工程

接口地址

/swp

HTTP Content-Type / 请求方式

application/json
POST

请求参数
参数 必选 类型 说明
RequestBody
vtt_arr jsonArray 字幕json数组,默认每5秒分割
knowledge jsonArray 知识点json数组
knowledge jsonArray 知识点json数组
swpid String 工程hashid
pdf_url String pid文件地址
image String 视频截图
video_name String 转封装的文件名称
predata array 转封装的文件对象
vtt_arr拆解
参数 必选 类型 说明
payload
content String 字幕内容
id Int 序号
sTime Int 开始时间(秒)
eTime Int 结束时间(秒)
knowledge->clips拆解
参数 必选 类型 说明
payload
type String 类型
duration Int 时长(秒)
question array 问答题topic_id数组
title String 知识点名称
content jsonArray 内容
sn String 存储知识元主机SN
resources array 所用资源hashid数组
predata拆解
参数 必选 类型 说明
payload
filePath String 文件地址
startTime Int 开始位置(字节)
endTime Int 结束位置(字节)
duration Int 总长(字节)

例:
{"vtt_arr":[{"content":"","id":1,"sTime":0,"eTime":5},{"content":"","id":2,"sTime":5,"eTime":10},{"content":"","id":3,"sTime":10,"eTime":15},{"content":"","id":4,"sTime":15,"eTime":20},{"content":"","id":5,"sTime":20,"eTime":25},{"content":"","id":6,"sTime":25,"eTime":30},{"content":"","id":7,"sTime":30,"eTime":35},{"content":"","id":8,"sTime":35,"eTime":40},{"content":"","id":9,"sTime":40,"eTime":45},{"content":"","id":10,"sTime":45,"eTime":50},{"content":"","id":11,"sTime":50,"eTime":55},{"content":"","id":12,"sTime":55,"eTime":60},{"content":"","id":13,"sTime":60,"eTime":65},{"content":"","id":14,"sTime":65,"eTime":70},{"content":"","id":15,"sTime":70,"eTime":75},{"content":"","id":16,"sTime":75,"eTime":80},{"content":"","id":17,"sTime":80,"eTime":85},{"content":"","id":18,"sTime":85,"eTime":90},{"content":"","id":19,"sTime":90,"eTime":95},{"content":"","id":20,"sTime":95,"eTime":100},{"content":"","id":21,"sTime":100,"eTime":105},{"content":"","id":22,"sTime":105,"eTime":110},{"content":"","id":23,"sTime":110,"eTime":115},{"content":"","id":24,"sTime":115,"eTime":120},{"content":"","id":25,"sTime":120,"eTime":125},{"content":"","id":26,"sTime":125,"eTime":130},{"content":"","id":27,"sTime":130,"eTime":135},{"content":"","id":28,"sTime":135,"eTime":140},{"content":"","id":29,"sTime":140,"eTime":145},{"content":"","id":30,"sTime":145,"eTime":150},{"content":"","id":31,"sTime":150,"eTime":155},{"content":"","id":32,"sTime":155,"eTime":160},{"content":"","id":33,"sTime":160,"eTime":165},{"content":"","id":34,"sTime":165,"eTime":170},{"content":"","id":35,"sTime":170,"eTime":175},{"content":"","id":36,"sTime":175,"eTime":180},{"content":"","id":37,"sTime":180,"eTime":185},{"content":"","id":38,"sTime":185,"eTime":190},{"content":"","id":39,"sTime":190,"eTime":191.358}],"knowledge":[{"clips":[{"type":"stream","duration":191.358,"thumbnail":"/img/8383558c1f7cd7b840b97ea1385f3be1?page=1","question":["65ac5c3e-e73d-4427-a969-627cb34be095"],"title":"开始测试","content":{"audio_only":false,"resource":"0fe993407a35c3c014f934c10ec65d9c","slide":{"file":"8383558c1f7cd7b840b97ea1385f3be1","cuepoint":[{"start":1.752,"end":193.11,"page_number":1,"params":{"vpercent":"60","imgPath":"/img/8383558c1f7cd7b840b97ea1385f3be1?page=1"}}]},"caption":[{"start":0,"end":5,"text":""},{"start":5,"end":10,"text":""},{"start":10,"end":15,"text":""},{"start":15,"end":20,"text":""},{"start":20,"end":25,"text":""},{"start":25,"end":30,"text":""},{"start":30,"end":35,"text":""},{"start":35,"end":40,"text":""},{"start":40,"end":45,"text":""},{"start":45,"end":50,"text":""},{"start":50,"end":55,"text":""},{"start":55,"end":60,"text":""},{"start":60,"end":65,"text":""},{"start":65,"end":70,"text":""},{"start":70,"end":75,"text":""},{"start":75,"end":80,"text":""},{"start":80,"end":85,"text":""},{"start":85,"end":90,"text":""},{"start":90,"end":95,"text":""},{"start":95,"end":100,"text":""},{"start":100,"end":105,"text":""},{"start":105,"end":110,"text":""},{"start":110,"end":115,"text":""},{"start":115,"end":120,"text":""},{"start":120,"end":125,"text":""},{"start":125,"end":130,"text":""},{"start":130,"end":135,"text":""},{"start":135,"end":140,"text":""},{"start":140,"end":145,"text":""},{"start":145,"end":150,"text":""},{"start":150,"end":155,"text":""},{"start":155,"end":160,"text":""},{"start":160,"end":165,"text":""},{"start":165,"end":170,"text":""},{"start":170,"end":175,"text":""},{"start":175,"end":180,"text":""},{"start":180,"end":185,"text":""},{"start":185,"end":190,"text":""},{"start":190,"end":191.358,"text":""}]}}],"title":"开始测试","sn":"SP05AV100034711A","resources":["/resource/0fe993407a35c3c014f934c10ec65d9c","/resource/8383558c1f7cd7b840b97ea1385f3be1"],"duration":191.358}],"swpid":"ca1b1145-de1a-4468-93c9-97e8db74e4c9","predata":[{"filePath":"/resource/0fe993407a35c3c014f934c10ec65d9c","startTime":1752,"endTime":193110,"duration":191358}],"video_url":"","pdf_url":"/resource/8383558c1f7cd7b840b97ea1385f3be1","video_name":"11","subject":"762","grade":"14","image":"/img/0fe993407a35c3c014f934c10ec65d9c"}

HTTP 响应状态

200

返回字段 字段类型 说明
status int 返回状态码
message String 返回错误信息
data Array 返回结果
接口示例

Response
{"success":true,"data":{"swpid":"ca1b1145-de1a-4468-93c9-97e8db74e4c9","title":"11","creator_nickname":"18675577003","creator_uid":"2","kplist":[{"klgid":"a51e09a8db555f603b627d98a06210f2","swpid":"ca1b1145-de1a-4468-93c9-97e8db74e4c9","swptitle":"","video_url":"","duration":191.358,"video_name":"11","assist_id":"","assist_url":"/resource/8383558c1f7cd7b840b97ea1385f3be1","assist_name":"","poster":"/img/8383558c1f7cd7b840b97ea1385f3be1?page=1","is_open":0,"open_type":0,"price":0,"tag":"","title":"开始测试","creator_uid":"2","creator_nickname":"18675577003","create_time":"2018-07-31 15:04:48","update_time":"2018-07-31 15:04:48","sn":"SP05AV100034711A","location":"","description":"","hide":0,"reserve1":"","subject":762,"grade":14,"clips":[{"type":"stream","duration":191.358,"thumbnail":"/img/8383558c1f7cd7b840b97ea1385f3be1?page=1","question":["65ac5c3e-e73d-4427-a969-627cb34be095"],"title":"开始测试","content":{"audio_only":false,"resource":"0fe993407a35c3c014f934c10ec65d9c","slide":{"file":"8383558c1f7cd7b840b97ea1385f3be1","cuepoint":[{"start":1.752,"end":193.11,"page_number":1,"params":{"vpercent":"60","imgPath":"/img/8383558c1f7cd7b840b97ea1385f3be1?page=1"}}]},"caption":[{"start":0,"end":5,"text":""},{"start":5,"end":10,"text":""},{"start":10,"end":15,"text":""},{"start":15,"end":20,"text":""},{"start":20,"end":25,"text":""},{"start":25,"end":30,"text":""},{"start":30,"end":35,"text":""},{"start":35,"end":40,"text":""},{"start":40,"end":45,"text":""},{"start":45,"end":50,"text":""},{"start":50,"end":55,"text":""},{"start":55,"end":60,"text":""},{"start":60,"end":65,"text":""},{"start":65,"end":70,"text":""},{"start":70,"end":75,"text":""},{"start":75,"end":80,"text":""},{"start":80,"end":85,"text":""},{"start":85,"end":90,"text":""},{"start":90,"end":95,"text":""},{"start":95,"end":100,"text":""},{"start":100,"end":105,"text":""},{"start":105,"end":110,"text":""},{"start":110,"end":115,"text":""},{"start":115,"end":120,"text":""},{"start":120,"end":125,"text":""},{"start":125,"end":130,"text":""},{"start":130,"end":135,"text":""},{"start":135,"end":140,"text":""},{"start":140,"end":145,"text":""},{"start":145,"end":150,"text":""},{"start":150,"end":155,"text":""},{"start":155,"end":160,"text":""},{"start":160,"end":165,"text":""},{"start":165,"end":170,"text":""},{"start":170,"end":175,"text":""},{"start":175,"end":180,"text":""},{"start":180,"end":185,"text":""},{"start":185,"end":190,"text":""},{"start":190,"end":191.358,"text":""}]}}],"resources":["/resource/0fe993407a35c3c014f934c10ec65d9c","/resource/8383558c1f7cd7b840b97ea1385f3be1"],"vtt_arr":"","subject_category":"","_id":"5b600a106fb89d67ec065401","public":0,"refcount":1}],"image":"/img/0fe993407a35c3c014f934c10ec65d9c","subject":762,"grade":14,"video_url":"","video_name":"11","assist_url":"/resource/8383558c1f7cd7b840b97ea1385f3be1","assist_name":"","sn":"","predata":[{"filePath":"/resource/0fe993407a35c3c014f934c10ec65d9c","startTime":1752,"endTime":193110,"duration":191358}],"vtt_arr":[{"content":"","id":1,"sTime":0,"eTime":5},{"content":"","id":2,"sTime":5,"eTime":10},{"content":"","id":3,"sTime":10,"eTime":15},{"content":"","id":4,"sTime":15,"eTime":20},{"content":"","id":5,"sTime":20,"eTime":25},{"content":"","id":6,"sTime":25,"eTime":30},{"content":"","id":7,"sTime":30,"eTime":35},{"content":"","id":8,"sTime":35,"eTime":40},{"content":"","id":9,"sTime":40,"eTime":45},{"content":"","id":10,"sTime":45,"eTime":50},{"content":"","id":11,"sTime":50,"eTime":55},{"content":"","id":12,"sTime":55,"eTime":60},{"content":"","id":13,"sTime":60,"eTime":65},{"content":"","id":14,"sTime":65,"eTime":70},{"content":"","id":15,"sTime":70,"eTime":75},{"content":"","id":16,"sTime":75,"eTime":80},{"content":"","id":17,"sTime":80,"eTime":85},{"content":"","id":18,"sTime":85,"eTime":90},{"content":"","id":19,"sTime":90,"eTime":95},{"content":"","id":20,"sTime":95,"eTime":100},{"content":"","id":21,"sTime":100,"eTime":105},{"content":"","id":22,"sTime":105,"eTime":110},{"content":"","id":23,"sTime":110,"eTime":115},{"content":"","id":24,"sTime":115,"eTime":120},{"content":"","id":25,"sTime":120,"eTime":125},{"content":"","id":26,"sTime":125,"eTime":130},{"content":"","id":27,"sTime":130,"eTime":135},{"content":"","id":28,"sTime":135,"eTime":140},{"content":"","id":29,"sTime":140,"eTime":145},{"content":"","id":30,"sTime":145,"eTime":150},{"content":"","id":31,"sTime":150,"eTime":155},{"content":"","id":32,"sTime":155,"eTime":160},{"content":"","id":33,"sTime":160,"eTime":165},{"content":"","id":34,"sTime":165,"eTime":170},{"content":"","id":35,"sTime":170,"eTime":175},{"content":"","id":36,"sTime":175,"eTime":180},{"content":"","id":37,"sTime":180,"eTime":185},{"content":"","id":38,"sTime":185,"eTime":190},{"content":"","id":39,"sTime":190,"eTime":191.358}]}}

1.16 根据MD5获取文件的hashId(用于检查文件是否上传过)

接口地址

/source/gethashid/{sourceid}?sn={sn}

HTTP Content-Type / 请求方式

application/json
GET

请求参数
参数 必选 类型 说明
RequestBody
sourceid String 文件
sn String 知识元主机sn

例:
/source/gethashid/58d1051c8ac0e1f046ff4c3f74fc609c?sn=SP05AV100034711A

HTTP 响应状态

200

返回字段 字段类型 说明
status int 返回状态码
message String 返回错误信息
data Array 返回结果
接口示例

Response
没有上传时:{"success":false,"msg":"source not exit"}
已上传过:{"success":true,"hashid":"8ee71a5c9607d1857a8148503833ba67","data":{"_id":"5b6010326fb89d67ec06541f","hashid":"8ee71a5c9607d1857a8148503833ba67","source_hashid":"58d1051c8ac0e1f046ff4c3f74fc609c","creator_uid":"2","name":"QQ20180731-153007-HD.mp4","fullname":"storage/swlsource/mp4/58d1051c8ac0e1f046ff4c3f74fc609c.mp4","type":"mp4","size":"4520200","time":1533022258253,"gop":-1,"day":"","start_time":"","end_time":"","duration":11,"catType":2,"catUuid":"","hide":0,"status":7,"sn":"SP05AV100034711A","in_weilubo":3,"error":"","tran_err_count":0,"sync_err_count":0,"use":0,"cs_path":"http://osspjs.sewise.com/58d1051c8ac0e1f046ff4c3f74fc609c"}}

1.17 同步app上传第三方云存储资源数据

接口地址

/source/addCsNew

HTTP Content-Type / 请求方式

application/json
POST

请求参数
参数 必选 类型 说明
RequestBody
source_hashid String 资源的hashid
cs_host String oss对象存储加速域名
cs_path String 存储地址
name String 资源名称
type String 类型:ts、mp4、png、jpg、gif、pic、pdf
size Int 资源大小
sn String 知识元主机sn
gop Int gop值(视频资源需传)

例:
{"source_hashid":"f4e18cd85088b6d49902622f4a65f679","cs_host":"oss.sewise.com","cs_path":"http://oss.sewise.com/f4e18cd85088b6d49902622f4a65f679","name":"bf17f4ab50fe9cb9e90ac041351d3946.ts","type":"ts","size":"1584840","sn":"SP05AV100034668A"}

HTTP 响应状态

200

返回字段 字段类型 说明
status int 返回状态码
message String 返回错误信息
data Array 返回结果
接口示例

Response
{"success":true,"hashid":"5f0922a49352a4d4d5a2eef6badd60e0","path":"/resource/5f0922a49352a4d4d5a2eef6badd60e0"}

添加新批注
在作者公开此批注前,只有你和作者可见。
回复批注