课程文档
益安
1.1. 创建课程
Description
用户创建课程信息
Method and URL Structure
| Method |
Resource URL |
| POST |
/education/courses/ |
Request Parameters
| Name |
Description |
Required |
Default |
| name |
课程名 |
Yes |
|
| description |
课程描述 |
No |
|
| category |
分类资源的pk/id |
No |
|
| picture |
课程图片 |
No |
|
| amount |
课程价格 |
No |
|
| grade |
课程分级 |
No |
junior |
| pay_course |
课程是否付费 |
No |
recommend |
| property_course |
课程属性 |
No |
develop |
- grade 课程等级分为三级,初级课程(junior)、中级课程(middle)、高级课程(senior),默认是初级课程
- pay_course 课程种类分为三级,推荐课程(recommend)、免费课程(free)、优惠课程(discount),默认是推荐课程
- property_course 课程属性分为四种,开发(develop)、运维(operation)、测试(test)、网络(network)
| Name |
Description |
Required |
Default |
| Authorization |
Token 7309fabd207c22e0a00eada158989b89ffe839ef |
Yes |
|
*Authorization的值为登录成功后返回值
Request
{ "name":"English", "description":"这是一门课", "category":1, "picture":"http://img5.imgtn.bdimg.com/it/u=3425851328,2681317699&fm=21&gp=0.jpg", "amount":"100.00", "grade":"junior", "pay_course":"recommend", "property_course":"develop",}
cURL Example
curl -X POST -H 'Authorization: Token 7309fa07c22e0a00eada158989b89ffe839ef' -d 'name=collection的使用&description=这是一个关于瀑布流开发的视频课程&category=9&picture=http://img5.imgtn.bdimg.com/it/u=3425851328,2681317699&fm=21&gp=0.jpg&amount=100.00&grade=junior&pay_course=recommend&property_course=develop' http://127.0.0.1:8000/education/courses/
JSON Response
{ "pk":9, "owner":"teacher", "category":9, "name":"collection的使用", "description":"这是一个关于瀑布流开发的视频课程", "picture":"http://img5.imgtn.bdimg.com/it/u=3425851328,2681317699&fm=21&gp=0.jpg", "amount":"100.00", "grade":"junior", "pay_course":"recommend", "property_course":"develop", "click":0, "payment_count":0, "create_time":"2016-04-27T06:28:12.440931Z"}
1.2. 修改课程
Description
用户修改课程信息
Method and URL Structure
| Method |
Resource URL |
| PUT |
/education/courses/${pk}/ |
Request Parameters
| Name |
Description |
Required |
Default |
| name |
课程名 |
Yes |
|
| description |
课程描述 |
No |
|
| category |
分类资源pk/id |
No |
|
| picture |
课程图片 |
No |
|
| amount |
课程价格 |
No |
|
| grade |
课程分级 |
No |
junior |
| pay_course |
课程是否付费 |
No |
recommend |
| property_course |
课程属性 |
No |
develop |
| Name |
Description |
Required |
Default |
| Authorization |
Token 7309fabd207c22e0a00eada158989b89ffe839ef |
Yes |
|
*Authorization的值为登录成功后返回值
Request
{ "name":"数学", "description":"这是一门课", "category":1, "picture":"http://example.com/1.jpg", "amount":"101.00", "grade":"junior", "pay_course":"recommend", "property_course":"develop",}
cURL Example
curl -X PUT -H 'Authorization: Token 7309fabd207c22e0a00eada158989b89ffe839ef' -d 'name=数学&description=math&category=1&picture=http://baidu.com/1.jpg&amount=101.00&grade=junior&pay_course=recommend&property_course=develop' http://127.0.0.1:8000/education/courses/1/
JSON Response
{ "pk":3, "owner":"teacher", "category":1, "name":"English", "description":"this is an lession.", "picture":"http://baidu.com/1.jpg", "amount":"101.00", "grade":"junior", "pay_course":"recommend", "property_course":"develop", "click":0, "payment_count":0, "create_time":"2016-04-12 10:30:20",}
1.3. 删除课程
Description
用户删除课程信息
Method and URL Structure
| Method |
Resource URL |
| DELETE |
/education/courses/${pk}/ |
| Name |
Description |
Required |
Default |
| Authorization |
Token 7309fabd207c22e0a00eada158989b89ffe839ef |
Yes |
|
*Authorization的值为登录成功后返回值
cURL Example
curl -X DELETE -H 'Authorization: Token 7309fabd207c22e0a00eada158989b89ffe839ef' http://127.0.0.1:8000/education/courses/1/
JSON Response
| Name |
Description |
Default |
| detail |
失败原因 |
Not found |
| status |
成功 |
204 |
1.4. 查看具体课程
Description
用户查询某一课程信息
Method and URL Structure
| Method |
Resource URL |
| GET |
/education/courses/${pk}/ |
| Name |
Description |
Required |
Default |
| Authorization |
Token 7309fabd207c22e0a00eada158989b89ffe839ef |
Yes |
|
*Authorization的值为登录成功后返回值
cURL Example
curl -X GET -H 'Authorization: Token 7309fabd207c22e0a00eada158989b89ffe839ef' http://127.0.0.1:8000/education/courses/1/
JSON Response
{ "pk": 6, "owner": null, "name": "超越满意-基于客户口碑的忠诚度管理(NPS)", "lecturer_describe": "", "description": "孙健\r\n曾任职于中国石化集团齐鲁石化公司、英国石油(BP上海赛科)公司 开发设计的《忠诚度净值(NPS)管理》荣获得2015年全国优秀课程奖 多年企业管理实战经验的积累、沉淀,孙健老师在培训和咨询服务项目中尤其善长:客户关系管理、企业赢利模式、企业文化、领导力、执行力、流程诊断、风险管理(MOR)、危机决策、问题解决、创新与敏捷项目、绩效管理(ISPI)、培训课程设计(6D)之类课题的定制化交付。", "picture": "http://www.51ean.com/res/attachment/adv/201605250917400977.jpg", "amount": "0.01", "original_price": "0.00", "grade": "junior", "click": 0, "payment_count": 0, "create_time": "2016-05-04T01:40:52.602954Z", "category": { "pk": 1, "name": "公开课", "parent": -1, "desc": "", "poster": "" }, "course_type": "develop", "course_type_display": "开发", "authenticated": true, "support_exam": true, "free_course": false, "discount_course": true, "recommend": true, "videos": [ { "pk": 8, "owner": "13264247066", "course": 6, "title": "ceshi2", "video_link": "https://media.html5media.info/video.mp4", "video_duration": "dddddd", "lecturer": "ddddd", "create_time": "2016-07-28T08:32:06.730000Z", "actual_study_number": 4, "is_audition": true }, { "pk": 6, "owner": "root", "course": 6, "title": "NPS3", "video_link": "", "video_duration": "", "lecturer": "", "create_time": "2016-05-06T02:34:26.499576Z", "actual_study_number": 0, "is_audition": false }, { "pk": 5, "owner": "root", "course": 6, "title": "NPS2", "video_link": "", "video_duration": "", "lecturer": "", "create_time": "2016-05-05T12:23:39.786396Z", "actual_study_number": 0, "is_audition": false }, { "pk": 1, "owner": "root", "course": 6, "title": "NPS", "video_link": "", "video_duration": "", "lecturer": "", "create_time": "2016-05-05T06:40:41.895790Z", "actual_study_number": 0, "is_audition": false } ], "examRule": []}
1.5. 获取所有课程
Description
用户查看所有课程信息
Method and URL Structure
| Method |
Resource URL |
| GET |
/education/courses/ |
Request Parameters
默认分页取数据库中最新的10条数据
| Name |
Description |
Required |
Default |
| page |
page Number |
Yes |
1 |
| category |
课程分类资源的pk/id |
No |
|
- 如果有category字段,且值不为空,得到的是某分类下所有课程
- 如果没有category字段,得到到是所有的课程信息
| Name |
Description |
Required |
Default |
| Authorization |
Token 7309fabd207c22e0a00eada158989b89ffe839ef |
Yes |
|
*Authorization的值为登录成功后返回值
cURL Example
curl -X GET -H 'Authorization: Token 7309fabd207c22e0a00eada158989b89ffe839ef' -d 'page=1' http://127.0.0.1:8000/education/courses/?category=1
JSON Response
{ "count": 10, "next": null, "previous": null, "results": [ { "pk": 10, "owner": null, "name": "Linux web渗透测试", "description": "系统安全,渗透测试", "picture": "http://www.51ean.com/res/attachment//store/3/goods/201607011753236704_small.jpg", "amount": "200.00", "grade": "junior", "click": 0, "payment_count": 0, "create_time": "2016-07-04T15:53:51.716707Z", "category": { "pk": 10, "name": "系统安全", "parent": 3 }, "course_type": "develop", "course_type_display": "开发", "authenticated": false, "support_exam": true, "free_course": false, "discount_course": false, "recommend": true, "videos": [], "examRule": [ { "pk": 5, "title": "linuxweb渗透考试2016", "description": "111111111111111111111111111111", "point": 2, "picture": "http://pic22.nipic.com/20120801/6608733_154516839000_2.jpg", "price": "2.00", "exercise_number": 10 } ] }, { "pk": 9, "owner": null, "name": "网络通讯协议", "description": "网络通讯协议", "picture": "http://www.51ean.com/res/attachment//store/3/goods/201605251843243761_small.jpg", "amount": "14.00", "grade": "junior", "click": 0, "payment_count": 0, "create_time": "2016-07-04T15:27:17.008638Z", "category": { "pk": 3, "name": "网络与系统安全", "parent": -1 }, "course_type": "develop", "course_type_display": "开发", "authenticated": false, "support_exam": false, "free_course": false, "discount_course": false, "recommend": false, "videos": [], "examRule": [ { "pk": 6, "title": "网络通讯协议考试2016", "description": "网络通讯协议考试2016网络通讯协议考试2016网络通讯协议考试2016网络通讯协议考试2016网络通讯协议考试2016网络通讯协议考试2016", "point": 2, "picture": "http://pic22.nipic.com/20120801/6608733_154516839000_2.jpg", "price": "2.00", "exercise_number": 5 } ] } ]}
2.1. 创建课程分类
Description
用户创建课程分类
Method and URL Structure
| Method |
Resource URL |
| POST |
/education/categorys/ |
Request Parameters
| Name |
Description |
Required |
Default |
| name |
分类名称 |
Yes |
|
| parent |
所属父级分类资源的pk/id |
Yes |
-1 |
parent 字段默认是-1,代表一级分类,parent字段为某分类的pk/id时,代表该分类下的子分类
| Name |
Description |
Required |
Default |
| Authorization |
Token 320a37f43fa80f52af27abe3b468d74204ccd180 |
Yes |
|
*Authorization的值为登录成功后返回值
JSON Request
{ "name":"ios开发", "parent":1,}
cURL Example
curl -X POST -H 'Authorization: Token 320a37f43fa80f52af27abe3b468d74204ccd180' -d 'name=开发&parent=1' http://127.0.0.1:8000/education/categorys/
JSON Response
{ "pk":7, "name":"ios开发", "parent":1,}
2.2. 获取所有课程分类
Description
用户获取所有课程分类
Method and URL Structure
| Method |
Resource URL |
| GET |
/education/categorys/ |
Request Parameters
| Name |
Description |
Required |
Default |
| parent |
某分类资源的pk/id |
Yes |
|
parent 为-1时得到的是一级分类,为其他时得到是该分类下的子分类
| Name |
Description |
Required |
Default |
| Authorization |
Token 7309fabd207c22e0a00eada158989b89ffe839ef |
Yes |
|
*Authorization的值为登录成功后返回值
cURL Example
curl -X GET -H 'Authorization: Ton 320a37f43fa80f52af27abe3b468d74204ccd180' http://127.0.0.1:8000/education/categorys/?parent=-1
JSON Response
[ {"pk":1,"name":"开发","parent":-1}, {"pk":2,"name":"测试","parent":-1}, {"pk":3,"name":"运维","parent":-1}, {"pk":4,"name":"安全","parent":-1}]
3.1. 创建视频
Description
用户创建课程视频
Method and URL Structure
| Method |
Resource URL |
| POST |
/education/videos/ |
Request Parameters
| Name |
Description |
Required |
Default |
| title |
视频标题 |
Yes |
|
| video_link |
视频地址 |
Yes |
|
| video_duration |
视频时长 |
No |
|
| lecturer |
讲师 |
No |
|
| course |
课程资源的pk/id |
Yes |
|
| Name |
Description |
Required |
Default |
| Authorization |
Token 7309fabd207c22e0a00eada158989b89ffe839ef |
Yes |
|
*Authorization的值为登录成功后返回值
Request
{ "title":"密码学", "video_link":"http://player.video.qiyi.com/b2f734d60a9108c7ccc9432d11d9ca3c/0/44/v_19rrlpmpfc.swf-albumId=473276500-tvId=473276500-isPurchase=0-cnId=25", "course":1,}
cURL Example
curl -X POST -H 'Authorization: Token 7309fabd207c22e0a00eada158989b89ffe839ef' -d 'title=密码学应用&video_link=http://player.video.qiyi.com/b2f734d60a9108c7ccc9432d11d9ca3c/0/44/v_19rrlpmpfc.swf-albumId=473276500-tvId=473276500-isPurchase=0-cnId=25&course=1' http://127.0.0.1:8000/education/videos/
JSON Response
{ "pk": 1, "owner": "teacher", "course": 1, "title": "密码学应用", "video_link": "http://player.video.qiyi.com/b2f734d60a9108c7ccc9432d11d9ca3c/0/44/v_19rrlpmpfc.swf-albumId=473276500-tvId=473276500-isPurchase=0-cnId=25", "video_duration": null, "lecturer": null, "create_time": "2016-04-19T08:54:22.719390Z"}
3.2. 修改视频信息
Description
用户修改具体视频信息
Method and URL Structure
| Method |
Resource URL |
| PUT |
/education/videos/${pk}/ |
Request Parameters
| Name |
Description |
Required |
Default |
| title |
视频标题 |
Yes |
|
| video_link |
视频地址 |
Yes |
|
| video_duration |
视频时长 |
No |
|
| lecturer |
讲师 |
No |
|
| Name |
Description |
Required |
Default |
| Authorization |
Token 7309fabd207c22e0a00eada158989b89ffe839ef |
Yes |
|
*Authorization的值为登录成功后返回值
Request
{ "title":"密码", "video_link":"http://player.video.qiyi.com/b2f734d60a9108c7ccc9432d11d9ca3c/0/44/v_19rrlpmpfc.swf-albumId=473276500-tvId=473276500-isPurchase=0-cnId=25", "video_duration":"01:30:30", "lecturer":"小红",}
cURL Example
curl -X PUT -H 'Authorization: Token 7309fabd207c22e0a00eada158989b89ffe839ef' -d 'title=密码&video_link=http://player.video.qiyi.com/b2f734d60a9108c7ccc9432d11d9ca3c/0/44/v_19rrlpmpfc.swf-albumId=473276500-tvId=473276500-isPurchase=0-cnId=25&video_duration=01:30:30&lecturer=小红' http://127.0.0.1:8000/education/videos/1/
JSON Response
{ "pk": 1, "owner": "teacher", "course": 1, "title": "密码", "video_link": "http://player.video.qiyi.com/b2f734d60a9108c7ccc9432d11d9ca3c/0/44/v_19rrlpmpfc.swf-albumId=473276500-tvId=473276500-isPurchase=0-cnId=25", "video_duration": "01:30:30", "lecturer": "小红", "create_time": "2016-04-19T08:54:22.719390Z"}
3.3. 删除视频
Description
用户删除视频
Method and URL Structure
| Method |
Resource URL |
| DELETE |
/education/videos/${pk}/ |
| Name |
Description |
Required |
Default |
| Authorization |
Token 7309fabd207c22e0a00eada158989b89ffe839ef |
Yes |
|
*Authorization的值为登录成功后返回值
cURL Example
curl -X DELETE -H 'Authorization: Token 7309fabd207c22e0a00eada158989b89ffe839ef' http://127.0.0.1:8000/education/videos/1/
JSON Response
| Name |
Description |
Default |
| detail |
失败原因 |
Not found |
| status |
成功 |
204 |
3.4. 查看具体视频信息
Description
用户查询某一视频信息
Method and URL Structure
| Method |
Resource URL |
| GET |
/education/videos/${pk}/ |
| Name |
Description |
Required |
Default |
| Authorization |
Token 7309fabd207c22e0a00eada158989b89ffe839ef |
Yes |
|
*Authorization的值为登录成功后返回值
cURL Example
curl -X GET -H 'Authorization: Token 7309fabd207c22e0a00eada158989b89ffe839ef' http://127.0.0.1:8000/education/videos/1/
JSON Response
{ "pk": 1, "owner": "teacher", "course": 1, "title": "密码", "video_link": "http://player.video.qiyi.com/b2f734d60a9108c7ccc9432d11d9ca3c/0/44/v_19rrlpmpfc.swf-albumId=473276500-tvId=473276500-isPurchase=0-cnId=25", "video_duration": "01:30:30", "lecturer": "小红", "create_time": "2016-04-19T08:54:22.719390Z"}
3.5. 获取某一课程下所有视频
Description
用户查看所有视频信息
Method and URL Structure
| Method |
Resource URL |
| GET |
/education/videos/ |
Request Parameters
默认分页取数据库中最新的10条数据
| Name |
Description |
Required |
Default |
| page |
page Number |
Yes |
1 |
| course |
课程资源的pk/id |
Yes |
|
| Name |
Description |
Required |
Default |
| Authorization |
Token 7309fabd207c22e0a00eada158989b89ffe839ef |
Yes |
|
*Authorization的值为登录成功后返回值
cURL Example
curl -X GET -H 'Authorization: Token 7309fabd207c22e0a00eada158989b89ffe839ef' -d 'page=1' http://127.0.0.1:8000/education/videos/?course=1
JSON Response
{ "count": 3, "next": null, "previous": null, "results": [ { "pk": 3, "owner": "teacher", "course": 1, "title": "密码学应用", "video_link": "http://player.video.qiyi.com/b2f734d60a9108c7ccc9432d11d9ca3c/0/44/v_19rrlpmpfc.swf-albumId=473276500-tvId=473276500-isPurchase=0-cnId=25", "video_duration": null, "lecturer": null, "create_time": "2016-04-19T09:42:46.729442Z" }, { "pk": 2, "owner": "teacher", "course": 1, "title": "密码学应用", "video_link": "http://player.video.qiyi.com/b2f734d60a9108c7ccc9432d11d9ca3c/0/44/v_19rrlpmpfc.swf-albumId=473276500-tvId=473276500-isPurchase=0-cnId=25", "video_duration": null, "lecturer": null, "create_time": "2016-04-19T09:42:42.842879Z" }, { "pk": 1, "owner": "teacher", "course": 1, "title": "密码", "video_link": "http://player.video.qiyi.com/b2f734d60a9108c7ccc9432d11d9ca3c/0/44/v_19rrlpmpfc.swf-albumId=473276500-tvId=473276500-isPurchase=0-cnId=25", "video_duration": "01:30:30", "lecturer": "小红", "create_time": "2016-04-19T08:54:22.719390Z" } ]}
4.1. 创建评价
Description
用户创建课程评价
Method and URL Structure
| Method |
Resource URL |
| POST |
/education/evaluates/ |
Request Parameters
| Name |
Description |
Required |
Default |
| score |
评分 |
Yes |
|
| content |
评价内容 |
No |
|
| course |
课程资源的pk/id |
Yes |
|
| Name |
Description |
Required |
Default |
| Authorization |
Token 7309fabd207c22e0a00eada158989b89ffe839ef |
Yes |
|
*Authorization的值为登录成功后返回值
Request
{ "score":5, "content":"very good", "course":1,}
cURL Example
curl -X POST -H 'Authorization: Token 7309fabd207c22e0a00eada158989b89ffe839ef' -d 'score=5&content=very good&course=1' http://127.0.0.1:8000/education/evaluates/
JSON Response
{ "pk": 1, "owner": "teacher", "course": { "pk": 1, "owner": "teacher", "category": 1, "name": "数学", "description": "math", "picture": "http://123.jpg", "amount": "20.00", "grade": "junior", "pay_course": "recommend", "property_course":"develop", "click": 0, "payment_count": 0, "create_time": "2016-04-11T07:42:40.097367Z" }, "score": 5, "content": "very good", "create_time": "2016-04-30T14:57:40.062543Z"}
4.2. 修改评价信息
Description
用户修改具体评论信息
Method and URL Structure
| Method |
Resource URL |
| PUT |
/education/evaluates/${pk}/ |
Request Parameters
| Name |
Description |
Required |
Default |
| score |
评分 |
Yes |
0 |
| content |
评价内容 |
No |
|
| Name |
Description |
Required |
Default |
| Authorization |
Token 7309fabd207c22e0a00eada158989b89ffe839ef |
Yes |
|
*Authorization的值为登录成功后返回值
Request
{ "score":3, "content":"not bad",}
cURL Example
curl -X PUT -H 'Authorization: Token 7309fabd207c22e0a00eada158989b89ffe839ef' -d 'score=3&content=not bad' http://127.0.0.1:8000/education/evaluates/1/
JSON Response
{ "pk": 1, "owner": "teacher", "course": { "pk": 1, "owner": "teacher", "category": 1, "name": "数学", "description": "math", "picture": "http://123.jpg", "amount": "20.00", "grade": "junior", "pay_course": "recommend", "property_course":"develop", "click": 0, "payment_count": 0, "create_time": "2016-04-11T07:42:40.097367Z" }, "score": 3, "content": "not bad", "create_time": "2016-04-30T14:57:40.062543Z"}
4.3. 删除评论
Description
用户删除评论
Method and URL Structure
| Method |
Resource URL |
| DELETE |
/education/evaluates/${pk}/ |
| Name |
Description |
Required |
Default |
| Authorization |
Token 7309fabd207c22e0a00eada158989b89ffe839ef |
Yes |
|
*Authorization的值为登录成功后返回值
cURL Example
curl -X DELETE -H 'Authorization: Token 7309fabd207c22e0a00eada158989b89ffe839ef' http://127.0.0.1:8000/education/evaluates/1/
JSON Response
| Name |
Description |
Default |
| detail |
失败原因 |
Not found |
| status |
成功 |
204 |
4.4. 查看具体评论信息
Description
用户查询某一评论信息
Method and URL Structure
| Method |
Resource URL |
| GET |
/education/evaluates/${pk}/ |
| Name |
Description |
Required |
Default |
| Authorization |
Token 7309fabd207c22e0a00eada158989b89ffe839ef |
Yes |
|
*Authorization的值为登录成功后返回值
cURL Example
curl -X GET -H 'Authorization: Token 7309fabd207c22e0a00eada158989b89ffe839ef' http://127.0.0.1:8000/education/evaluates/1/
JSON Response
{ "pk": 1, "owner": "teacher", "course": { "pk": 1, "owner": "teacher", "category": 1, "name": "数学", "description": "math", "picture": "http://123.jpg", "amount": "20.00", "grade": "junior", "pay_course": "recommend", "property_course":"develop", "click": 0, "payment_count": 0, "create_time": "2016-04-11T07:42:40.097367Z" }, "score": 3, "content": "not bad", "create_time": "2016-04-30T14:57:40.062543Z"}
5.5. 获取某一课程下所有评论
Description
用户查看所有评论信息
Method and URL Structure
| Method |
Resource URL |
| GET |
/education/evaluates/ |
Request Parameters
默认分页取数据库中最新的10条数据
| Name |
Description |
Required |
Default |
| page |
page Number |
Yes |
1 |
| course |
课程资源的pk/id |
Yes |
|
| Name |
Description |
Required |
Default |
| Authorization |
Token 7309fabd207c22e0a00eada158989b89ffe839ef |
Yes |
|
*Authorization的值为登录成功后返回值
cURL Example
curl -X GET -H 'Authorization: Token 7309fabd207c22e0a00eada158989b89ffe839ef' -d 'page=1' http://127.0.0.1:8000/education/evaluates/?course=1
JSON Response
{ "count": 1, "next": null, "previous": null, "results": [ { "pk": 1, "owner": "teacher", "course": { "pk": 1, "owner": "teacher", "category": 1, "name": "数学", "description": "math", "picture": "http://123.jpg", "amount": "20.00", "grade": "junior", "pay_course": "recommend", "property_course":"develop", "click": 0, "payment_count": 0, "create_time": "2016-04-11T07:42:40.097367Z" }, "score": 3, "content": "not bad", "create_time": "2016-04-30T14:57:40.062543Z" } ]}
01. 获取我购买的课程
Description
用户查看所有课程信息
Method and URL Structure
| Method |
Resource URL |
| GET |
/education/my_courses/ |
Request Parameters
默认分页取数据库中最新的10条数据
| Name |
Description |
Required |
Default |
| page |
page Number |
Yes |
1 |
| Name |
Description |
Required |
Default |
| Authorization |
Token 7309fabd207c22e0a00eada158989b89ffe839ef |
Yes |
|
*Authorization的值为登录成功后返回值
cURL Example
curl -X GET -H 'Authorization: Token 7309fabd207c22e0a00eada158989b89ffe839ef' http://127.0.0.1:8000/education/my_courses/?page=1
JSON Response
{ "count": 6, "next": null, "previous": null, "results": [ { "pk": 6, "owner": "teacher", "category": null, "name": "物理", "description": null, "picture": "", "amount": "0.00", "grade": "junior", "pay_course": "recommend", "property_course":"develop", "click": 0, "payment_count": 0, "create_time": "2016-04-16T10:41:40.439941Z" }, { "pk": 5, "owner": "teacher", "category": 1, "name": "物理", "description": "", "picture": "", "amount": "0.00", "grade": "junior", "pay_course": "recommend", "property_course":"develop", "click": 0, "payment_count": 0, "create_time": "2016-04-13T06:29:39.353072Z" }, { "pk": 4, "owner": "teacher", "category": 1, "name": "物理", "description": "", "picture": "", "amount": "0.00", "grade": "junior", "pay_course": "recommend", "property_course":"develop", "click": 0, "payment_count": 0, "create_time": "2016-04-12T03:38:46.946221Z" }, { "pk": 3, "owner": "root", "category": 1, "name": "英语", "description": "", "picture": "http://123.jpg", "amount": "0.00", "grade": "junior", "pay_course": "recommend", "property_course":"develop", "click": 0, "payment_count": 0, "create_time": "2016-04-12T03:36:39.933083Z" }, { "pk": 2, "owner": "teacher", "category": 1, "name": "英语", "description": "this is an english lession", "picture": "http://123.jpg", "amount": "100.00", "grade": "junior", "pay_course": "recommend", "property_course":"develop", "click": 0, "payment_count": 0, "create_time": "2016-04-12T03:26:53.544948Z" }, { "pk": 1, "owner": "teacher", "category": 1, "name": "数学", "description": "math", "picture": "http://123.jpg", "amount": "20.00", "grade": "junior", "pay_course": "recommend", "property_course":"develop", "click": 0, "payment_count": 0, "create_time": "2016-04-11T07:42:40.097367Z" } ]}
02. 搜索课程
Description
用户根据课程名/课程属性搜索课程
Method and URL Structure
| Method |
Resource URL |
| GET |
/education/courses_search/ |
Request Parameters
默认分页取数据库中最新的10条数据
| Name |
Description |
Required |
Default |
| page |
page Number |
Yes |
1 |
| keyword |
课程名称关键字/课程属性 |
Yes |
|
课程属性为:开发(develop)、运维(operation)、测试(test)、网络(network)
课程属性:推荐课程(recommend)、免费课程(free)、优惠课程(discount)
| Name |
Description |
Required |
Default |
| Authorization |
Token 7309fabd207c22e0a00eada158989b89ffe839ef |
Yes |
|
*Authorization的值为登录成功后返回值
cURL Example
curl -X GET -H 'Authorization: Token 7309fabd207c22e0a00eada158989b89ffe839ef' -d 'page=1' http://127.0.0.1:8000/education/courses_search/?keyword=语
JSON Response
{ "count":2, "next":null, "previous":null, "results": [ { "pk":3, "owner":"root", "category":1, "name":"英语", "description":"", "picture":"http://123.jpg", "amount":"0.00", "grade":"junior", "pay_course":"recommend", "property_course":"develop", "click":0, "payment_count":0, "create_time":"2016-04-12T03:36:39.933083Z" }, { "pk":2, "owner":"teacher", "category":1, "name":"英语", "description":"this is an english lession", "picture":"http://123.jpg","amount":"100.00", "grade":"junior", "pay_course":"recommend", "property_course":"develop", "click":0, "payment_count":0, "create_time":"2016-04-12T03:26:53.544948Z" } ]}
03. 用户是否购买课程的验证
Description
用户根据课程id/pk,判断自己是否购买了此课程
Method and URL Structure
| Method |
Resource URL |
| GET |
/education/course_verify/ |
Request Parameter
| Name |
Description |
Required |
Default |
| course |
课程id/pk |
Yes |
|
| video_id |
视频id/pk |
Yes |
|
| Name |
Description |
Required |
Default |
| Authorization |
Token 7309fabd207c22e0a00eada158989b89ffe839ef |
Yes |
|
*Authorization的值为登录成功后返回值
cURL Example
curl -X GET -H 'Authorization: Token 706a87288233ea2427cddb8a1bbce29369ac5073' http://127.0.0.1:8000/education/course_verify/?course=6&video_id=8
JSON Response
{ "pk": 8, "owner": "13264247066", "course": 6, "title": "ceshi2", "video_link": "https://media.html5media.info/video.mp4", "video_duration": "dddddd", "lecturer": "ddddd", "create_time": "2016-07-28T08:32:06.730000Z", "actual_study_number": 4, "is_audition": true}
Error JSON Response
{ "status": 0, "message": "没有购买该课程"}
04. 获取我购买的课程以及评价
Description
用户查看所有课程信息
Method and URL Structure
| Method |
Resource URL |
| GET |
/education/my_list_courses/ |
Request Parameters
默认分页取数据库中最新的10条数据
| Name |
Description |
Required |
Default |
| page |
page Number |
Yes |
1 |
| Name |
Description |
Required |
Default |
| Authorization |
Token 7309fabd207c22e0a00eada158989b89ffe839ef |
Yes |
|
*Authorization的值为登录成功后返回值
cURL Example
curl -X GET -H 'Authorization: Token 7309fabd207c22e0a00eada158989b89ffe839ef' http://127.0.0.1:8000/education/my_list_courses/?page=1
JSON Response
{ "results": [ { "status": "你还没有评价", "picture": "", "description": null, "grade": "junior", "property_course": "develop", "pay_course": "recommend", "create_time": "2016-04-16T10:41:40.439Z", "owner": "teacher", "click": 0, "name": "物理", "amount": "0.00", "pk": 6, "payment_count": 0 }, { "status": "你还没有评价", "picture": "", "description": "", "grade": "junior", "property_course": "develop", "pay_course": "recommend", "create_time": "2016-04-13T06:29:39.353Z", "owner": "teacher", "click": 0, "name": "物理", "amount": "0.00", "pk": 5, "payment_count": 0 }, { "status": "你还没有评价", "picture": "", "description": "", "grade": "junior", "property_course": "develop", "pay_course": "recommend", "create_time": "2016-04-12T03:38:46.946Z", "owner": "teacher", "click": 0, "name": "物理", "amount": "0.00", "pk": 4, "payment_count": 0 }, { "status": "你还没有评价", "picture": "http://123.jpg", "description": "", "grade": "junior", "property_course": "develop", "pay_course": "recommend", "create_time": "2016-04-12T03:36:39.933Z", "owner": "root", "click": 0, "name": "英语", "amount": "0.00", "pk": 3, "payment_count": 0 }, { "status": "你还没有评价", "picture": "http://123.jpg", "description": "this is an english lession", "grade": "junior", "property_course": "develop", "pay_course": "recommend", "create_time": "2016-04-12T03:26:53.544Z", "owner": "teacher", "click": 0, "name": "英语", "amount": "100.00", "pk": 2, "payment_count": 0 }, { "status": "已评价", "picture": "http://123.jpg", "description": "math", "grade": "junior", "property_course": "develop", "pay_course": "recommend", "create_time": "2016-04-11T07:42:40.097Z", "owner": "teacher", "click": 0, "name": "数学", "content": "not bad", "amount": "20.00", "score": 3, "pk": 1, "payment_count": 0 } ]}
05. 过滤课程
Description
用户根据课程类型/课程是否付费/课程是否推荐过滤课程
Method and URL Structure
| Method |
Resource URL |
| GET |
/education/courses_filter/ |
Request Parameters
默认分页取数据库中最新的10条数据
| Name |
Description |
Required |
Default |
| page |
page Number |
Yes |
1 |
课程类型为:开发(develop)、运维(operation)、测试(test)、网络(network)
课程是否付费:免费课程(free)、优惠课程(discount)
cURL Example
1:(课程类型)develop、operation、test、networkcurl -X GET -d 'page=1' http://127.0.0.1:8000/education/courses_filter/?course_type=develop2:(推荐课程)curl -X GET -d 'page=1' http://127.0.0.1:8000/education/courses_filter/?recommend=13:(免费课程)curl -X GET -d 'page=1' http://127.0.0.1:8000/education/courses_filter/?free_course=14:(优惠课程)curl -X GET -d 'page=1' http://127.0.0.1:8000/education/courses_filter/?discount_course=15:(某课程类型下课程的免费课程)curl -X GET -d 'page=1' http://127.0.0.1:8000/education/courses_filter/?course_type=develop&free_course=16:(某课程类型下推荐课程)curl -X GET -d 'page=1' http://127.0.0.1:8000/education/courses_filter/?course_type=develop&recommend=1
JSON Response
{ "count": 1, "next": null, "previous": null, "results": [ { "pk": 5, "owner": "", "name": "构建云数据一体化运维体系", "description": "康楠 中国联通集团云数据公司运维与服务部总经理 现任中国联通集团云数据公司运维与服务部总经理。中央党校研究生院经济学专业研究生学历、高级工程师。原中国软件运营服务(SaaS)专家顾问团成员。中国数据中心产业发展联盟常务理事、专家委员,技术委员会主任,ODCA开放数据中心联盟工作组成员,工信部云计算发展与政策论坛专家委员,中国通信标准化协会(CCSA)数据中心联盟副理事长、江苏信息服务产业基地专家委员、呼和浩特市云计算产业专家顾问组专家委员、北京电子学会专家委员、MDC Club专家委员、中国工程建设标准化协会专家委员。《通信产业报》、《通信世界周刊》、中国信息产业网CNII、中国通信网、《现代数据中心》特约撰稿人。近年来,参与完成十余项研究、规划、标准课题项目,在行业刊物上发表学术性文章数十篇,编著《数据中心系统工程及应用》、参著《运维菜鸟到大咖你还有多远》。", "picture": "http://pic.huodongjia.com/event/2015-07-02/event1435804641.08.jpg", "amount": "0.01", "grade": "junior", "click": 1, "payment_count": 2, "create_time": "2016-04-20T15:48:21.104130Z", "category": { "pk": 9, "name": "网络安全", "parent": 3 }, "course_type": "develop", "course_type_display": "开发", "authenticated": false, "support_exam": true, "free_course": false, "discount_course": true, "recommend": false, "videos": [ { "pk": 4, "owner": "18672767274", "course": 5, "title": "构建云数据2", "video_link": "http://m.iqiyi.com/edu/20130408/bcd5628b900832a3.html#vfrm=2-3-0-1", "video_duration": "", "lecturer": "", "create_time": "2016-05-05T08:00:59.501492Z", "actual_study_number": 0 }, { "pk": 3, "owner": "18672767274", "course": 5, "title": "构建云数据课程1 超越满意-基于客户口碑的忠诚度管理(NPS)", "video_link": "http://m.iqiyi.com/edu/20130408/bcd5628b900832a3.html#vfrm=2-3-0-1", "video_duration": "", "lecturer": "", "create_time": "2016-05-05T07:08:27.597660Z", "actual_study_number": 0 }, { "pk": 2, "owner": "18672767274", "course": 5, "title": "云数据", "video_link": "http://m.iqiyi.com/edu/20130408/dd6dbf70e90322bb.html#vfrm=2-3-0-1", "video_duration": "", "lecturer": "", "create_time": "2016-05-05T06:43:06.163020Z", "actual_study_number": 0 } ], "examRule": [ { "pk": 4, "title": "构建云数据一体化数据考试2016", "description": "构建云数据一体化数据考试2016构建云数据一体化数据考试2016构建云数据一体化数据考试2016构建云数据一体化数据考试2016构建云数据一体化数据考试2016", "point": 2, "picture": "http://pic22.nipic.com/20120801/6608733_154516839000_2.jpg", "price": "2.00", "exercise_number": 10 }, { "pk": 2, "title": "测试1", "description": "范德萨范德萨", "point": 0, "picture": "http://test.ean.haorenao.cn:8080/admin/education/examrule/add/", "price": "0.00", "exercise_number": 10 } ] } ]}
05. 查询相关课程
Description
通过传入某个课程的id和分类id查询与该课程相关的课程列表
Method and URL Structure
| Method |
Resource URL |
| GET |
/education/course_related/ |
Request Parameters
| Name |
Description |
Required |
Default |
| category |
课程分类id |
Yes |
1 |
| course_pk |
课程id |
Yes |
1 |
cURL Example
curl -X GET http://127.0.0.1:8000/education/course_related/?category=2&course_pk=7
### JSON Response``` json{ "count": 2, "next": null, "previous": null, "results": [ { "pk": 7, "owner": null, "name": "云计算时代的内容管理", "lecturer_describe": null, "description": "内容管理,云计算", "picture": "http://www.51ean.com/res/attachment//store/3/goods/201607011513497853_small.jpg", "amount": "15.00", "original_price": "0.00", "grade": "junior", "click": 0, "payment_count": 0, "create_time": "2016-07-04T15:22:52.535651Z", "category": { "pk": 2, "name": "云计算与大数据", "parent": -1, "desc": "", "poster": "" }, "course_type": "develop", "course_type_display": "开发", "authenticated": false, "support_exam": false, "free_course": false, "discount_course": false, "recommend": false, "videos": [], "examRule": [] }, { "pk": 2, "owner": "小小明", "name": "云\"动\"未来—世纪互联云战略解读", "lecturer_describe": null, "description": "沈寓实 世纪互联集团副总裁、(云)首席技术官/中国云体系联盟秘书长 沈寓实,博士,MBA,教授。在ICT领域将近20年的科研、研发和管理经验,云计算、视频编解码和无线通信领域国际专家,跨国公司高管,华人和科技社团领袖。现任世纪互联集团副总裁、(云)首席技术官,是中国云体系产业创新战略联盟的主要发起人之一和现任秘书长。", "picture": "http://img2.imgtn.bdimg.com/it/u=585892028,1905396312&fm=15&gp=0.jpg", "amount": "0.00", "original_price": "0.00", "grade": "junior", "click": 0, "payment_count": 0, "create_time": "2016-04-20T15:48:09.028755Z", "category": { "pk": 2, "name": "云计算与大数据", "parent": -1, "desc": "", "poster": "" }, "course_type": "develop", "course_type_display": "开发", "authenticated": false, "support_exam": false, "free_course": false, "discount_course": false, "recommend": false, "videos": [], "examRule": [] } ]}