每日一星
金色童年
获取每日一星列表
Method and URL Structure
Method |
Resource URL |
GET |
/photograph/star_baby/ |
cURL Example
curl http://localhost/photograph/star_baby/
Reponse
{
"count":1,
"next":null,
"previous":null,
"results":[{
"pk":4,
"author":"test author",
"description":"test description",
"location":"南柯郡汶汶乡大槐树",
"age":5,
"name":"赵小明",
"shop_name":"济南店",
"published": "2017-02-17",
"created":"2017-02-17T15:02:04.019783",
"post_id": 4,
"photograph_set":[{
"pk":11,
"title":"xiaoming's photo",
"desc":"南柯郡汶汶乡大槐树",
"file_url":"http://www.example.com/2.jpg",
"taken_date":"2016-07-01",
"taken_location":"",
"author":"布可朔夫",
"created":"2017-02-17T15:02:04.012395",
"albums":[{
"album":"11",
"name":"相册第一",
"created":"2017-02-17T15:02:03.989893"
}, {
"album":"10",
"name":"全部",
"created":"2017-02-17T15:02:03.972189"
}],
hs_collect":false,
"private_url":{
"url":"http://www.example.com/2.jpg",
"url_1000":"http://www.example.com/2.jpg-w1000",
"url_500":"http://www.example.com/2.jpg-w500",
"url_150x150":"http://www.example.com/2.jpg-150x150",
}
},...],
}...]
}
获取一期每日一星的详情
Method and URL Structure
Method |
Resource URL |
GET |
/photograph/star_baby/${pk} |
cURL Example
curl http://localhost/photograph/star_baby/12345/
Response
{
"pk":4,
"author":"test author",
"description":"test description",
"location":"南柯郡汶汶乡大槐树",
"age":5,
"name":"赵小明",
"shop_name":"济南店",
"published": "2017-02-17",
"created":"2017-02-17T15:02:04.019783",
"post_id": 4,
"photograph_set":[{
"pk":11,
"title":"xiaoming's photo",
"desc":"南柯郡汶汶乡大槐树",
"file_url":"http://www.example.com/2.jpg",
"taken_date":"2016-07-01",
"taken_location":"",
"author":"布可朔夫",
"created":"2017-02-17T16:30:13.003939",
"albums":[{
"album":"11",
"name":"相册第一",
"created":"2017-02-17T16:30:12.976375"
}, {
"album":"10",
"name":"全部",
"created":"2017-02-17T16:30:12.956691"
}],
"has_collect":false,
"private_url":{
"url":"http://www.example.com/2.jpg",
"url_1000":"http://www.example.com/2.jpg-w1000",
"url_500":"http://www.example.com/2.jpg-w500",
"url_150x150":"http://www.example.com/2.jpg-150x150",
}
},...]
}
用名字、店铺名字搜索每日一星
Method and URL Structure
Method |
Resource URL |
GET |
/photograph/star_baby/ |
Parameters
Name |
Description |
name |
名字,模糊查询 |
shop_name |
店铺名字,模糊查询 |
cURL Example
curl http://localhost/photograph/star_baby/?search=关键字
用发布日期获取每日一星
Method and URL Structure
Method |
Resource URL |
GET |
/photograph/star_baby/ |
Parameters
Name |
Description |
published |
发布日期 |
cURL Example
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
{
"author": u'布可朔夫',
"description": "描述",
"location": u"南柯郡汶汶乡大槐树",
"name" : u"张小明",
"shop_name": u"济南店",
"age" : 5,
"photograph_set": [{
"title": "xiaoming's photo",
"desc": u"南柯郡汶汶乡大槐树",
"file_url": "http://www.example.com/1.jpg",
"taken_date": "2016-07-01",
},{
"title": "xiaoming's photo",
"desc": u"南柯郡汶汶乡大槐树",
"file_url": "http://www.example.com/2.jpg",
"taken_date": "2016-07-01",
}]
}
cURL Example
curl -X PUT -H 'Authorization: Token 9944b09199c62bcf9418ad846dd0e4bbdfc6ee4b'\
-H 'Content-Type: Application/json' --data '{....}' http://localhost/photograph/start_baby/create/?album=12347