[关闭]
@fuyb1986 2017-02-21T11:48:22.000000Z 字数 3116 阅读 1326

每日一星

金色童年


获取每日一星列表

Method and URL Structure

Method Resource URL
GET /photograph/star_baby/

cURL Example

  1. curl http://localhost/photograph/star_baby/

Reponse

  1. {
  2. "count":1,
  3. "next":null,
  4. "previous":null,
  5. "results":[{
  6. "pk":4,
  7. "author":"test author",
  8. "description":"test description",
  9. "location":"南柯郡汶汶乡大槐树",
  10. "age":5,
  11. "name":"赵小明",
  12. "shop_name":"济南店",
  13. "published": "2017-02-17",
  14. "created":"2017-02-17T15:02:04.019783",
  15. "post_id": 4,
  16. "photograph_set":[{
  17. "pk":11,
  18. "title":"xiaoming's photo",
  19. "desc":"南柯郡汶汶乡大槐树",
  20. "file_url":"http://www.example.com/2.jpg",
  21. "taken_date":"2016-07-01",
  22. "taken_location":"",
  23. "author":"布可朔夫",
  24. "created":"2017-02-17T15:02:04.012395",
  25. "albums":[{
  26. "album":"11",
  27. "name":"相册第一",
  28. "created":"2017-02-17T15:02:03.989893"
  29. }, {
  30. "album":"10",
  31. "name":"全部",
  32. "created":"2017-02-17T15:02:03.972189"
  33. }],
  34. hs_collect":false,
  35. "private_url":{
  36. "url":"http://www.example.com/2.jpg",
  37. "url_1000":"http://www.example.com/2.jpg-w1000",
  38. "url_500":"http://www.example.com/2.jpg-w500",
  39. "url_150x150":"http://www.example.com/2.jpg-150x150",
  40. }
  41. },...],
  42. }...]
  43. }

获取一期每日一星的详情

Method and URL Structure

Method Resource URL
GET /photograph/star_baby/${pk}

cURL Example

  1. curl http://localhost/photograph/star_baby/12345/

Response

  1. {
  2. "pk":4,
  3. "author":"test author",
  4. "description":"test description",
  5. "location":"南柯郡汶汶乡大槐树",
  6. "age":5,
  7. "name":"赵小明",
  8. "shop_name":"济南店",
  9. "published": "2017-02-17",
  10. "created":"2017-02-17T15:02:04.019783",
  11. "post_id": 4,
  12. "photograph_set":[{
  13. "pk":11,
  14. "title":"xiaoming's photo",
  15. "desc":"南柯郡汶汶乡大槐树",
  16. "file_url":"http://www.example.com/2.jpg",
  17. "taken_date":"2016-07-01",
  18. "taken_location":"",
  19. "author":"布可朔夫",
  20. "created":"2017-02-17T16:30:13.003939",
  21. "albums":[{
  22. "album":"11",
  23. "name":"相册第一",
  24. "created":"2017-02-17T16:30:12.976375"
  25. }, {
  26. "album":"10",
  27. "name":"全部",
  28. "created":"2017-02-17T16:30:12.956691"
  29. }],
  30. "has_collect":false,
  31. "private_url":{
  32. "url":"http://www.example.com/2.jpg",
  33. "url_1000":"http://www.example.com/2.jpg-w1000",
  34. "url_500":"http://www.example.com/2.jpg-w500",
  35. "url_150x150":"http://www.example.com/2.jpg-150x150",
  36. }
  37. },...]
  38. }

用名字、店铺名字搜索每日一星

Method and URL Structure

Method Resource URL
GET /photograph/star_baby/

Parameters

Name Description
name 名字,模糊查询
shop_name 店铺名字,模糊查询

cURL Example

  1. curl http://localhost/photograph/star_baby/?search=关键字

用发布日期获取每日一星

Method and URL Structure

Method Resource URL
GET /photograph/star_baby/

Parameters

Name Description
published 发布日期

cURL Example

  1. curl http://localhost/photograph/star_baby/?published=2017-01-02

发布每日一星

Method and URL Structure

Method Resource URL
POST /photograph/star_baby/create/

Request Data

Name Description Required Default
author 作者 NO
description 描述 YES
location 拍摄地点 YES
photograph_set 照片集合 YES
name 名字 YES
shop_name 店铺名字 YES
age 年龄 YES

Requeset Parameters

Name Description Required Default
album 相册 YES

Request

  1. {
  2. "author": u'布可朔夫',
  3. "description": "描述",
  4. "location": u"南柯郡汶汶乡大槐树",
  5. "name" : u"张小明",
  6. "shop_name": u"济南店",
  7. "age" : 5,
  8. "photograph_set": [{
  9. "title": "xiaoming's photo",
  10. "desc": u"南柯郡汶汶乡大槐树",
  11. "file_url": "http://www.example.com/1.jpg",
  12. "taken_date": "2016-07-01",
  13. },{
  14. "title": "xiaoming's photo",
  15. "desc": u"南柯郡汶汶乡大槐树",
  16. "file_url": "http://www.example.com/2.jpg",
  17. "taken_date": "2016-07-01",
  18. }]
  19. }

cURL Example

  1. curl -X PUT -H 'Authorization: Token 9944b09199c62bcf9418ad846dd0e4bbdfc6ee4b'\
  2. -H 'Content-Type: Application/json' --data '{....}' http://localhost/photograph/start_baby/create/?album=12347
添加新批注
在作者公开此批注前,只有你和作者可见。
回复批注