相册
金色童年
创建相册
相册不能重名
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
{ "name":"相册第一", "desc":u'南柯郡汶汶乡大槐树', "private": true, "owner": "939",}
cURL Example
curl -X PUT -H 'Authorization: Token 9944b09199c62bcf9418ad846dd0e4bbdfc6ee4b'\-H 'Content-Type: Application/json' --data '{....}' http://localhost/photograph/album/create/
Respone Data
| Name |
Description |
| name |
昵称 |
| desc |
描述 |
| private |
是否私密相册 |
Reponse
{ "name":"相册第一", "desc":u'南柯郡汶汶乡大槐树', "private": true,}
相册列表
Method and URL Structure
| Method |
Resource URL |
| GET |
/photograph/albums/ |
Request
cURL Example
curl -H 'Authorization: Token 9944b09199c62bcf9418ad846dd0e4bbdfc6ee4b'http://localhost/photograph/album/
Respone Data
| Name |
Description |
| name |
昵称 |
| desc |
描述 |
| private |
是否私密相册 |
| shared |
是否分享 |
| profile |
创建者的用户信息 |
| cover |
封面:第一张照片 |
Reponse
{ "count":3, "next":null, "previous":null, "results":[{ "pk":3, "profile":{ "owner":1, "nickname":"xiaoming", "avatar_url":"http://www.example.com/xiaoming.jpg", "slogan":"xiaoming's slogan" }, "name":"相册第二", "desc":"南柯郡汶汶乡大槐树", "private":true, "shared": false, "created":"2016-08-27T15:34:43.537067Z", "cover": { "title": u"照片第一标题" "file_url": { "url": "http://example.com/1.jpg", "url_150x150": "http://example.com/1.jpg-150x150" }, "take_date": "2015-07-20T09:11:11.123456Z", } }...]}
获取某个相册
Method and URL Structure
| Method |
Resource URL |
| GET |
/photograph/album/${album pk}/ |
Request
No Applicatied
cURL Example
curl -H 'Authorization: Token 9944b09199c62bcf9418ad846dd0e4bbdfc6ee4b'http://localhost/photograph/album/12345/
Respone Data
| Name |
Description |
| name |
昵称 |
| desc |
描述 |
| private |
是否私密相册 |
| shared |
是否分享 |
| profile |
创建者的用户信息 |
| cover |
封面:第一张照片 |
Reponse
{ "pk": 3, "profile": { "owner": 1, "nickname": "xiaoming", "avatar_url": "http://example.com/1.png", "slogan": "slogan", }, "name": "相册第三", "desc": "南柯郡无名乡大槐树", "private": true, "ceate_time": "2016-09-11T15:34:33.449123Z", "photograp_set":[{ "pk":6, "owner":"xiaoming", "title":"xiaoming's photo", "desc":"南柯郡汶汶乡大槐树", "shared": false, "post_ptr": 77, "file_url": { "url": "http://example.com/1.jpg", "url_150x150": "http://example.com/1.jpg-150x150" }, "taken_date":"2016-07-01T03:00:03Z", "top":false, "created":"2016-08-27T15:34:43.540297Z" },....], "cover": { "title": u"照片第一标题" "file_url": { "url": "http://example.com/1.jpg", "url_150x150": "http://example.com/1.jpg-150x150" }, "take_date": "2015-07-20T09:11:11.123456Z", }}
删除某个相册
Method and URL Structure
只能删除用户创建的相册, 删除后照片不会删除
| Method |
Resource URL |
| DELETE |
/photograph/album/delete/${album pk}/ |
Request
cURL Example
curl -X DELETE -H 'Authorization: Token 9944b09199c62bcf9418ad846dd0e4bbdfc6ee4b'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
curl http://localhost/photograph/system_albums/?category=first_month
Response
{ "count":1, "next":null, "previous":null, "results":[{ "pk":25, "name":"相册第二", "desc":"南柯郡汶汶乡大槐树", "post_ptr": 79, "private":true, "created":"2016-09-28T02:42:17.418206Z", "profile":{ "owner":14, "nickname":"xiaoming", "avatar_url":"http://www.example.com/xiaoming.jpg", "slogan":"xiaoming's slogan" }, "cover":{ "pk":37, "title":"xiaoming's photo", "file_url": { "url": "http://example.com/1.jpg", "url_150x150": "http://example.com/1.jpg-150x150" }, "taken_date":"2016-07-01T03:00:03Z" } }]}
删除某个相册
只能删除用户自己创建的相册
Method and URL Structure
| Method |
Resource URL |
| DELETE |
/photograph/album/delete/${album pk}/ |
cURL Example
curl -H 'Authorization: Token 9944b09199c62bcf9418ad846dd0e4bbdfc6ee4b'http://localhost/photograph/album/delete/12345/