[关闭]
@fuyb1986 2017-05-11T04:32:09.000000Z 字数 3534 阅读 667

店铺信息

金色童年


获取店铺信息

Method and URL Structure

Method Resource URL
GET /shop/${pk}/

Request Paramaters

No Applicatated

cURL Example

  1. curl -H 'Authorization: Token 9944b09199c62bcf9418ad846dd0e4bbdfc6ee4b'\ http://localhost/shop/1234/

Response

  1. {
  2. "pk": 3,
  3. "owner": "13245678910"
  4. "name": "xxx摄影",
  5. "avatar_url":"http://www.example.com/xiaoming.jpg",
  6. "address":'南柯郡汶汶乡大槐树',
  7. "linkman": "010-012345678",
  8. "desc": "简介",
  9. "region": "华东地区",
  10. "province": "上海",
  11. "city": "上海市",
  12. "district": "浦东新区",
  13. "position":"31.233571841551807,121.50726079919434",
  14. }

更新店铺信息

使用 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

  1. {
  2. "name": "新名字",
  3. "avatar_url":"http://www.example.com/test001.jpg",
  4. "address":u'南柯郡汶汶乡大槐树',
  5. "linkman": "联系人",
  6. "desc": "简介",
  7. "region": "华东地区",
  8. "province": "上海",
  9. "city": "上海市",
  10. "district": "浦东新区",
  11. "position":"31.233571841551807,121.50726079919434",
  12. }

cURL Example

  1. curl -X PUT -H 'Authorization: Token 9944b09199c62bcf9418ad846dd0e4bbdfc6ee4b'\
  2. -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

  1. {
  2. "name": "新名字",
  3. "avatar_url":"http://www.example.com/test001.jpg",
  4. "address":u'南柯郡汶汶乡大槐树',
  5. "linkman": "联系人",
  6. "desc": "简介",
  7. "region": "华东地区",
  8. "province": "上海",
  9. "city": "上海市",
  10. "district": "浦东新区",
  11. "position":"31.233571841551807,121.50726079919434",
  12. }

获取店铺首页的三个相册

按设计图上的顺序

Method and URL Structure

Method Resource URL
GET /shop/albums/${shop pk}

cURL Example

  1. curl http://localhost/shop/albums/1234/

Reponse

  1. {
  2. "count": 3,
  3. "next":null,
  4. "previous":null,
  5. "results":[{
  6. "pk":123,
  7. "name":"优秀作品",
  8. "desc":"",
  9. "private": false,
  10. "created":"2016-08-27T15:34:43.537067Z",
  11. "new_list":[
  12. "http://www.example.com/11.jpg",
  13. "http://www.example.com/10.jpg",
  14. "http://www.example.com/9.jpg"
  15. ]
  16. }, {
  17. "pk": 124,
  18. "name": "门店展示",
  19. "desc": ""
  20. "private": false,
  21. "created":"2016-08-27T15:34:43.537067Z",
  22. "new_list":[
  23. "http://www.example.com/8.jpg",
  24. "http://www.example.com/7.jpg",
  25. "http://www.example.com/6.jpg"
  26. ]
  27. }, {
  28. "pk": 125,
  29. "name": "新品发布"
  30. "desc": ""
  31. "private": false,
  32. "created": "2016-08-27T15:34:43.537067Z",
  33. "new_list":[
  34. "http://www.example.com/4.jpg",
  35. "http://www.example.com/3.jpg",
  36. "http://www.example.com/2.jpg"
  37. ]
  38. }]
  39. }

搜索店铺信息

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

  1. curl http://localhost/shop/?name=金色童年儿童摄影&address=雨里路999号&linkman=0531-12345678

Response

  1. {
  2. "count":1,
  3. "next":null,
  4. "previous":null,
  5. "results":[{
  6. "pk":8,
  7. "owner":14,
  8. "name":"金色童年摄影雨里店",
  9. "avatar_url":"http://pic.example.com/0.jpg",
  10. "address":"雨里路",
  11. "linkman":"0531-12345678 12345679",
  12. "desc":"店铺介绍"
  13. "region": "华东地区",
  14. "province": "上海",
  15. "city": "上海市",
  16. "district": "浦东新区",
  17. "position":"31.233571841551807,121.50726079919434",
  18. }]
  19. }

为您服务店铺列表

Method and URL Structure

Method Resource URL
GET /shop/neaby/

Request Paramaters

Name Description Required Default
position 位置信息 yes

cURL Example

  1. 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

  1. {
  2. "count":1,
  3. "next":null,
  4. "previous":null,
  5. "results":[{
  6. "pk":18,
  7. "owner":39,
  8. "username":"shop_user000c",
  9. "name":"店三",
  10. "avatar_url":"http://pic.example.com/0.jpg",
  11. "region":"华东地区",
  12. "province":"上海",
  13. "city":"上海市",
  14. "district":"浦东新区",
  15. "address":"云里路",
  16. "linkman":"13212345671",
  17. "desc":"店铺介绍",
  18. "position":"31.21843415810747,121.55334830694574",
  19. "completed":false
  20. }....]
  21. }
添加新批注
在作者公开此批注前,只有你和作者可见。
回复批注