[关闭]
@fuyb1986 2017-05-11T11:04:02.000000Z 字数 3509 阅读 794

相册

金色童年


创建相册

相册不能重名

Method and URL Structure

Method Resource URL
POST /photograph/album/create/

Request Data

Name Description Required Default
name 昵称 YES
desc 描述 YES
private 是否私密相册: true/false YES
owner 用户 id YES

Request

  1. {
  2. "name":"相册第一",
  3. "desc":u'南柯郡汶汶乡大槐树',
  4. "private": true,
  5. "owner": "939",
  6. }

cURL Example

  1. curl -X PUT -H 'Authorization: Token 9944b09199c62bcf9418ad846dd0e4bbdfc6ee4b'\
  2. -H 'Content-Type: Application/json' --data '{....}' http://localhost/photograph/album/create/

Respone Data

Name Description
name 昵称
desc 描述
private 是否私密相册

Reponse

  1. {
  2. "name":"相册第一",
  3. "desc":u'南柯郡汶汶乡大槐树',
  4. "private": true,
  5. }

相册列表

Method and URL Structure

Method Resource URL
GET /photograph/albums/

Request

cURL Example

  1. curl -H 'Authorization: Token 9944b09199c62bcf9418ad846dd0e4bbdfc6ee4b'
  2. http://localhost/photograph/album/

Respone Data

Name Description
name 昵称
desc 描述
private 是否私密相册
shared 是否分享
profile 创建者的用户信息
cover 封面:第一张照片

Reponse

  1. {
  2. "count":3,
  3. "next":null,
  4. "previous":null,
  5. "results":[{
  6. "pk":3,
  7. "profile":{
  8. "owner":1,
  9. "nickname":"xiaoming",
  10. "avatar_url":"http://www.example.com/xiaoming.jpg",
  11. "slogan":"xiaoming's slogan"
  12. },
  13. "name":"相册第二",
  14. "desc":"南柯郡汶汶乡大槐树",
  15. "private":true,
  16. "shared": false,
  17. "created":"2016-08-27T15:34:43.537067Z",
  18. "cover": {
  19. "title": u"照片第一标题"
  20. "file_url": {
  21. "url": "http://example.com/1.jpg",
  22. "url_150x150": "http://example.com/1.jpg-150x150"
  23. },
  24. "take_date": "2015-07-20T09:11:11.123456Z",
  25. }
  26. }...]
  27. }

获取某个相册

Method and URL Structure

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

Request

No Applicatied

cURL Example

  1. curl -H 'Authorization: Token 9944b09199c62bcf9418ad846dd0e4bbdfc6ee4b'
  2. http://localhost/photograph/album/12345/

Respone Data

Name Description
name 昵称
desc 描述
private 是否私密相册
shared 是否分享
profile 创建者的用户信息
cover 封面:第一张照片

Reponse

  1. {
  2. "pk": 3,
  3. "profile": {
  4. "owner": 1,
  5. "nickname": "xiaoming",
  6. "avatar_url": "http://example.com/1.png",
  7. "slogan": "slogan",
  8. },
  9. "name": "相册第三",
  10. "desc": "南柯郡无名乡大槐树",
  11. "private": true,
  12. "ceate_time": "2016-09-11T15:34:33.449123Z",
  13. "photograp_set":[{
  14. "pk":6,
  15. "owner":"xiaoming",
  16. "title":"xiaoming's photo",
  17. "desc":"南柯郡汶汶乡大槐树",
  18. "shared": false,
  19. "post_ptr": 77,
  20. "file_url": {
  21. "url": "http://example.com/1.jpg",
  22. "url_150x150": "http://example.com/1.jpg-150x150"
  23. },
  24. "taken_date":"2016-07-01T03:00:03Z",
  25. "top":false,
  26. "created":"2016-08-27T15:34:43.540297Z"
  27. },....],
  28. "cover": {
  29. "title": u"照片第一标题"
  30. "file_url": {
  31. "url": "http://example.com/1.jpg",
  32. "url_150x150": "http://example.com/1.jpg-150x150"
  33. },
  34. "take_date": "2015-07-20T09:11:11.123456Z",
  35. }
  36. }

删除某个相册

Method and URL Structure

只能删除用户创建的相册, 删除后照片不会删除

Method Resource URL
DELETE /photograph/album/delete/${album pk}/

Request

cURL Example

  1. curl -X DELETE -H 'Authorization: Token 9944b09199c62bcf9418ad846dd0e4bbdfc6ee4b'
  2. http://localhost/photograph/album/delete/12345/

获取定格童年相册列表

按图片上的顺序

Method and URL Structure

Method Resource URL
GET /photograph/system_albums/

Request

Name Descript Required Default
category 类型 YES

Category List

Value Text Descript
pregnancy 孕味
first_month 满月
100_day 百天
choildren 大童
parent-child 亲子
faimily 全家福
exterior 外景

cURL Example

  1. curl http://localhost/photograph/system_albums/?category=first_month

Response

  1. {
  2. "count":1,
  3. "next":null,
  4. "previous":null,
  5. "results":[{
  6. "pk":25,
  7. "name":"相册第二",
  8. "desc":"南柯郡汶汶乡大槐树",
  9. "post_ptr": 79,
  10. "private":true,
  11. "created":"2016-09-28T02:42:17.418206Z",
  12. "profile":{
  13. "owner":14,
  14. "nickname":"xiaoming",
  15. "avatar_url":"http://www.example.com/xiaoming.jpg",
  16. "slogan":"xiaoming's slogan"
  17. },
  18. "cover":{
  19. "pk":37,
  20. "title":"xiaoming's photo",
  21. "file_url": {
  22. "url": "http://example.com/1.jpg",
  23. "url_150x150": "http://example.com/1.jpg-150x150"
  24. },
  25. "taken_date":"2016-07-01T03:00:03Z"
  26. }
  27. }]
  28. }

删除某个相册

只能删除用户自己创建的相册

Method and URL Structure

Method Resource URL
DELETE /photograph/album/delete/${album pk}/

cURL Example

  1. curl -H 'Authorization: Token 9944b09199c62bcf9418ad846dd0e4bbdfc6ee4b'
  2. http://localhost/photograph/album/delete/12345/
添加新批注
在作者公开此批注前,只有你和作者可见。
回复批注