[关闭]
@JackieQu 2018-09-05T11:15:10.000000Z 字数 3505 阅读 275

创作作品

儿童编程


创建作品

Method and Url Structure

Method Resource URL
POST /server/show/showwork_create/

cURL Example

  1. curl -X POST -H 'Authorization: Token tester001' -d data{...}
  2. 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

  1. {
  2. "name": "test3",
  3. "work_type": "html",
  4. "content": ",,,",
  5. "images": "img1,img2",
  6. "html": "<...>",
  7. "js": "...",
  8. "css": "..."
  9. }

JSON Response

  1. {
  2. "pk": 14,
  3. "student": {
  4. "pk": 1,
  5. "owner": "tester001",
  6. "name": "tester",
  7. "nickname": "test",
  8. "avatar": "http://test.png",
  9. "sex": "S",
  10. "birthday": null
  11. },
  12. "name": "test3",
  13. "other": null,
  14. "content": ",,,",
  15. "works": null,
  16. "images": "img1,img2",
  17. "html": "<...>",
  18. "js": "...",
  19. "css": "...",
  20. "work_type": "html",
  21. "status": 3,
  22. "status_display": "待申请",
  23. "create_time": "2018-09-05T10:50:37.258793"
  24. }

作品列表/我的作品

Method and Url Structure

Method Resource URL
GET /server/show/showworks/
GET /server/show/myshowworks/

cURL Example

  1. curl -X GET -H 'Authorization: Token tester001' -d data{...}
  2. # 核审通过才有
  3. localhost:8000/server/show/showworks/?work_type=html
  4. localhost:8000/server/show/myshowworks/?work_type=html

JSON Response

  1. {
  2. "count": 1,
  3. "next": null,
  4. "previous": null,
  5. "results": [
  6. {
  7. "pk": 8,
  8. "student": {
  9. "pk": 1,
  10. "owner": "tester001",
  11. "name": "tester",
  12. "nickname": "test",
  13. "avatar": "http://test.png",
  14. "sex": "S",
  15. "birthday": null
  16. },
  17. "name": "1234",
  18. "other": null,
  19. "works": "",
  20. "images": "",
  21. "html": null,
  22. "js": null,
  23. "css": null,
  24. "work_type": "html",
  25. "status": 1,
  26. "status_display": "已通过",
  27. "create_time": "2018-09-03T15:55:37.030622"
  28. }
  29. ]
  30. }

作品详情

Method and Url Structure

Method Resource URL
GET /server/show/showworks/${pk}/

cURL Example

  1. curl -X GET -H 'Authorization: Token tester001' -d data{...}
  2. # 核审通过才有
  3. localhost:8000/server/show/showworks/2/

JSON Response

  1. {
  2. "pk": 8,
  3. "student": {
  4. "pk": 1,
  5. "owner": "tester001",
  6. "name": "tester",
  7. "nickname": "test",
  8. "avatar": "http://test.png",
  9. "sex": "S",
  10. "birthday": null
  11. },
  12. "name": "test3",
  13. "other": null,
  14. "content": ",,,",
  15. "works": "",
  16. "images": "img1,img2",
  17. "html": "<...>",
  18. "js": "...",
  19. "css": "...",
  20. "work_type": "html",
  21. "status": 1,
  22. "status_display": "已通过",
  23. "create_time": "2018-09-03T15:55:37.030622"
  24. }

作品详情/修改作品/删除作品

Method and Url Structure

Method Resource URL
PATCH/PUT /server/show/showworks/pk/
DELETE /server/show/showworks/pk/

cURL Example

  1. curl -X PUT -H 'Authorization: Token tester001' -d data{...}
  2. # 核审通过才有
  3. 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

  1. {
  2. "content": ",,,",
  3. "images": "img1,img2",
  4. "html": "<...>",
  5. "js": ".3345..",
  6. "css": "..444."
  7. }

JSON Response

  1. {
  2. "pk": 8,
  3. "student": {
  4. "pk": 1,
  5. "owner": "tester001",
  6. "name": "tester",
  7. "nickname": "test",
  8. "avatar": "http://test.png",
  9. "sex": "S",
  10. "birthday": null
  11. },
  12. "name": "test3",
  13. "other": null,
  14. "content": ",,,",
  15. "works": "",
  16. "images": "img1,img2",
  17. "html": "<...>",
  18. "js": ".3345..",
  19. "css": "..444.",
  20. "work_type": "html",
  21. "status": 1,
  22. "status_display": "已通过",
  23. "create_time": "2018-09-03T15:55:37.030622"
  24. }

申请展示审核

Method and Url Structure

Method Resource URL
POST /server/show/showwork_apply_check/

cURL Example

  1. curl -X POST -H 'Authorization: Token tester001' -d data{...}
  2. localhost:8000/server/show/showwork_apply_check/

Request

Name Description Required Default
pk 作品pk YES

Request Data

  1. {
  2. "pk": "3"
  3. }

JSON Response

  1. # "status": 0, "status_display": "待核审",
  2. # "status": 1, "status_display": "已通过",
  3. # "status": 2, "status_display": "未通过",
  4. # "status": 3, "status_display": "待申请",
  5. {
  6. "pk": 3,
  7. "student": {
  8. "pk": 1,
  9. "owner": "tester001",
  10. "name": "tester",
  11. "nickname": "test",
  12. "avatar": "http://test.png",
  13. "sex": "S",
  14. "birthday": null
  15. },
  16. "name": "test3",
  17. "other": null,
  18. "content": ",,,",
  19. "works": null,
  20. "images": "img1,img2",
  21. "html": "<...>",
  22. "js": "...",
  23. "css": "...",
  24. "work_type": "html",
  25. "status": 0,
  26. "status_display": "待核审",
  27. "create_time": "2018-09-03T15:51:21.072329"
  28. }
添加新批注
在作者公开此批注前,只有你和作者可见。
回复批注