店铺信息
金色童年
获取店铺信息
Method and URL Structure
Method |
Resource URL |
GET |
/shop/${pk}/ |
Request Paramaters
No Applicatated
cURL Example
curl -H 'Authorization: Token 9944b09199c62bcf9418ad846dd0e4bbdfc6ee4b'\ http://localhost/shop/1234/
Response
{
"pk": 3,
"owner": "13245678910"
"name": "xxx摄影",
"avatar_url":"http://www.example.com/xiaoming.jpg",
"address":'南柯郡汶汶乡大槐树',
"linkman": "010-012345678",
"desc": "简介",
"region": "华东地区",
"province": "上海",
"city": "上海市",
"district": "浦东新区",
"position":"31.233571841551807,121.50726079919434",
}
更新店铺信息
使用 PUT 更新信息,就算某个字段没有更新,也要传递给接口
使用 PATCH 更新信息,可以更新其中一个或多个
Method and URL Structure
Method |
Resource URL |
Descrtipion |
PUT |
/shop/{pk}/ |
更新部分字段 |
Request Data
Name |
Description |
Required |
Default |
name |
店铺名称 |
YES |
|
avatar_url |
头像地址 |
YES |
|
address |
地址 |
YES |
|
linkman |
联系人 |
YES |
|
desc |
简介 |
YES |
|
Request
{
"name": "新名字",
"avatar_url":"http://www.example.com/test001.jpg",
"address":u'南柯郡汶汶乡大槐树',
"linkman": "联系人",
"desc": "简介",
"region": "华东地区",
"province": "上海",
"city": "上海市",
"district": "浦东新区",
"position":"31.233571841551807,121.50726079919434",
}
cURL Example
curl -X PUT -H 'Authorization: Token 9944b09199c62bcf9418ad846dd0e4bbdfc6ee4b'\
-H 'Content-Type: Application/json' --data '{....}' http://localhost/shop/1234/
Response Data
Name |
Description |
name |
店铺名称 |
avatar_url |
头像地址 |
address |
地址 |
linkman |
联系人 |
desc |
简介 |
region |
地区 |
province |
省 |
city |
市 |
district |
区 |
position |
坐标 |
Response
{
"name": "新名字",
"avatar_url":"http://www.example.com/test001.jpg",
"address":u'南柯郡汶汶乡大槐树',
"linkman": "联系人",
"desc": "简介",
"region": "华东地区",
"province": "上海",
"city": "上海市",
"district": "浦东新区",
"position":"31.233571841551807,121.50726079919434",
}
获取店铺首页的三个相册
按设计图上的顺序
Method and URL Structure
Method |
Resource URL |
GET |
/shop/albums/${shop pk} |
cURL Example
curl http://localhost/shop/albums/1234/
Reponse
{
"count": 3,
"next":null,
"previous":null,
"results":[{
"pk":123,
"name":"优秀作品",
"desc":"",
"private": false,
"created":"2016-08-27T15:34:43.537067Z",
"new_list":[
"http://www.example.com/11.jpg",
"http://www.example.com/10.jpg",
"http://www.example.com/9.jpg"
]
}, {
"pk": 124,
"name": "门店展示",
"desc": ""
"private": false,
"created":"2016-08-27T15:34:43.537067Z",
"new_list":[
"http://www.example.com/8.jpg",
"http://www.example.com/7.jpg",
"http://www.example.com/6.jpg"
]
}, {
"pk": 125,
"name": "新品发布"
"desc": ""
"private": false,
"created": "2016-08-27T15:34:43.537067Z",
"new_list":[
"http://www.example.com/4.jpg",
"http://www.example.com/3.jpg",
"http://www.example.com/2.jpg"
]
}]
}
搜索店铺信息
Method and URL Structure
Method |
Resource URL |
GET |
/shop/ |
Request Paramaters
Name |
Description |
Required |
Default |
name |
店铺名称 |
NO |
|
address |
地址 |
NO |
|
linkman |
联系电话 |
NO |
|
region |
地区 |
NO |
|
province |
省 |
NO |
|
position |
位置信息 |
NO |
|
cURL Example
curl http://localhost/shop/?name=金色童年儿童摄影&address=雨里路999号&linkman=0531-12345678
Response
{
"count":1,
"next":null,
"previous":null,
"results":[{
"pk":8,
"owner":14,
"name":"金色童年摄影雨里店",
"avatar_url":"http://pic.example.com/0.jpg",
"address":"雨里路",
"linkman":"0531-12345678 12345679",
"desc":"店铺介绍"
"region": "华东地区",
"province": "上海",
"city": "上海市",
"district": "浦东新区",
"position":"31.233571841551807,121.50726079919434",
}]
}
为您服务店铺列表
Method and URL Structure
Method |
Resource URL |
GET |
/shop/neaby/ |
Request Paramaters
Name |
Description |
Required |
Default |
position |
位置信息 |
yes |
|
cURL Example
curl http://localhost/shop/neaby/?position=31.221517,121.54437899999994
Response Data
Name |
Description |
name |
店铺名称 |
avatar_url |
头像地址 |
address |
地址 |
linkman |
联系人 |
desc |
简介 |
region |
地区 |
province |
省 |
city |
市 |
district |
区 |
position |
坐标 |
completed |
数据是否完整 |
Response
{
"count":1,
"next":null,
"previous":null,
"results":[{
"pk":18,
"owner":39,
"username":"shop_user000c",
"name":"店三",
"avatar_url":"http://pic.example.com/0.jpg",
"region":"华东地区",
"province":"上海",
"city":"上海市",
"district":"浦东新区",
"address":"云里路",
"linkman":"13212345671",
"desc":"店铺介绍",
"position":"31.21843415810747,121.55334830694574",
"completed":false
}....]
}