创作作品
儿童编程
创建作品
Method and Url Structure
Method |
Resource URL |
POST |
/server/show/showwork_create/ |
cURL Example
curl -X POST -H 'Authorization: Token tester001' -d data{...}
localhost:8000/server/show/showwork_create/
Request
Name |
Description |
Required |
Default |
name |
作品名 |
YES |
|
work_type |
作品类型 |
YES |
scratch2 |
content |
详情 |
NO |
|
images |
封面 |
NO |
|
html |
html |
NO |
|
js |
js |
NO |
|
css |
css |
NO |
|
Request Data
{
"name": "test3",
"work_type": "html",
"content": ",,,",
"images": "img1,img2",
"html": "<...>",
"js": "...",
"css": "..."
}
JSON Response
{
"pk": 14,
"student": {
"pk": 1,
"owner": "tester001",
"name": "tester",
"nickname": "test",
"avatar": "http://test.png",
"sex": "S",
"birthday": null
},
"name": "test3",
"other": null,
"content": ",,,",
"works": null,
"images": "img1,img2",
"html": "<...>",
"js": "...",
"css": "...",
"work_type": "html",
"status": 3,
"status_display": "待申请",
"create_time": "2018-09-05T10:50:37.258793"
}
作品列表/我的作品
Method and Url Structure
Method |
Resource URL |
GET |
/server/show/showworks/ |
GET |
/server/show/myshowworks/ |
cURL Example
curl -X GET -H 'Authorization: Token tester001' -d data{...}
# 核审通过才有
localhost:8000/server/show/showworks/?work_type=html
localhost:8000/server/show/myshowworks/?work_type=html
JSON Response
{
"count": 1,
"next": null,
"previous": null,
"results": [
{
"pk": 8,
"student": {
"pk": 1,
"owner": "tester001",
"name": "tester",
"nickname": "test",
"avatar": "http://test.png",
"sex": "S",
"birthday": null
},
"name": "1234",
"other": null,
"works": "",
"images": "",
"html": null,
"js": null,
"css": null,
"work_type": "html",
"status": 1,
"status_display": "已通过",
"create_time": "2018-09-03T15:55:37.030622"
}
]
}
作品详情
Method and Url Structure
Method |
Resource URL |
GET |
/server/show/showworks/${pk}/ |
cURL Example
curl -X GET -H 'Authorization: Token tester001' -d data{...}
# 核审通过才有
localhost:8000/server/show/showworks/2/
JSON Response
{
"pk": 8,
"student": {
"pk": 1,
"owner": "tester001",
"name": "tester",
"nickname": "test",
"avatar": "http://test.png",
"sex": "S",
"birthday": null
},
"name": "test3",
"other": null,
"content": ",,,",
"works": "",
"images": "img1,img2",
"html": "<...>",
"js": "...",
"css": "...",
"work_type": "html",
"status": 1,
"status_display": "已通过",
"create_time": "2018-09-03T15:55:37.030622"
}
作品详情/修改作品/删除作品
Method and Url Structure
Method |
Resource URL |
PATCH/PUT |
/server/show/showworks/pk/ |
DELETE |
/server/show/showworks/pk/ |
cURL Example
curl -X PUT -H 'Authorization: Token tester001' -d data{...}
# 核审通过才有
localhost:8000/server/show/showworks/8/
Request
Name |
Description |
Required |
Default |
content |
详情 |
NO |
|
images |
封面 |
NO |
|
html |
html |
NO |
|
js |
js |
NO |
|
css |
css |
NO |
|
Request Data
{
"content": ",,,",
"images": "img1,img2",
"html": "<...>",
"js": ".3345..",
"css": "..444."
}
JSON Response
{
"pk": 8,
"student": {
"pk": 1,
"owner": "tester001",
"name": "tester",
"nickname": "test",
"avatar": "http://test.png",
"sex": "S",
"birthday": null
},
"name": "test3",
"other": null,
"content": ",,,",
"works": "",
"images": "img1,img2",
"html": "<...>",
"js": ".3345..",
"css": "..444.",
"work_type": "html",
"status": 1,
"status_display": "已通过",
"create_time": "2018-09-03T15:55:37.030622"
}
申请展示审核
Method and Url Structure
Method |
Resource URL |
POST |
/server/show/showwork_apply_check/ |
cURL Example
curl -X POST -H 'Authorization: Token tester001' -d data{...}
localhost:8000/server/show/showwork_apply_check/
Request
Name |
Description |
Required |
Default |
pk |
作品pk |
YES |
|
Request Data
{
"pk": "3"
}
JSON Response
# "status": 0, "status_display": "待核审",
# "status": 1, "status_display": "已通过",
# "status": 2, "status_display": "未通过",
# "status": 3, "status_display": "待申请",
{
"pk": 3,
"student": {
"pk": 1,
"owner": "tester001",
"name": "tester",
"nickname": "test",
"avatar": "http://test.png",
"sex": "S",
"birthday": null
},
"name": "test3",
"other": null,
"content": ",,,",
"works": null,
"images": "img1,img2",
"html": "<...>",
"js": "...",
"css": "...",
"work_type": "html",
"status": 0,
"status_display": "待核审",
"create_time": "2018-09-03T15:51:21.072329"
}