[关闭]
@JackieQu 2018-06-12T17:06:55.000000Z 字数 2192 阅读 342

收货地址

好热闹TeaShop


创建收货地址

Method and Url Structure

Method Resource URL
POST /account/address_create/

Request and Parameters

Name Description Required Default
linkman 联系人 NO
telephone 电话 NO
shipping_address 收货地址 NO
default 是否默认 NO

Request

  1. {
  2. "linkman": "陈浩南",
  3. "telephone": "12345678",
  4. "shipping_address": "铜锣湾",
  5. "default": true
  6. }

cURL Example

  1. curl -X POST -H 'Authorization: Token 7dccb47cbeb6a283013708ed983712fc6488aa74'
  2. http://127.0.0.1:8000/account/address_create/

JSON Response

  1. {
  2. "pk": 3,
  3. "owner": "opSbp2JARhmzgmez9yObTt9aSybs2",
  4. "linkman": "陈浩南",
  5. "telephone": "12345678",
  6. "shipping_address": "铜锣湾",
  7. "default": true
  8. }

查看收货地址

Method and Url Structure

Method Resource URL
GET /account/addresses/

cURL Example

  1. curl -X POST -H 'Authorization: Token 7dccb47cbeb6a283013708ed983712fc6488aa74'
  2. http://127.0.0.1:8000/account/addresses/

JSON Response

  1. {
  2. "count": 2,
  3. "next": null,
  4. "previous": null,
  5. "results": [
  6. {
  7. "pk": 3,
  8. "owner": "opSbp2JARhmzgmez9yObTt9aSybs2",
  9. "linkman": "陈浩南",
  10. "telephone": "12345678",
  11. "shipping_address": "铜锣湾",
  12. "default": true
  13. },
  14. {
  15. "pk": 2,
  16. "owner": "opSbp2JARhmzgmez9yObTt9aSybs2",
  17. "linkman": null,
  18. "telephone": null,
  19. "shipping_address": null,
  20. "default": false
  21. }
  22. ]
  23. }

查看地址详情

Method and Url Structure

Method Resource URL
GET /account/addresses/

Request and Parameters

Name Description Required Default
pk ok YES

Request

  1. 3

cURL Example

  1. curl -X POST -H 'Authorization: Token 7dccb47cbeb6a283013708ed983712fc6488aa74'
  2. http://127.0.0.1:8000/account/addresses/3/

JSON Response

  1. {
  2. "pk": 3,
  3. "owner": "opSbp2JARhmzgmez9yObTt9aSybs2",
  4. "linkman": "陈浩南",
  5. "telephone": "12345678",
  6. "shipping_address": "铜锣湾",
  7. "default": true
  8. }

查看默认地址

Method and Url Structure

Method Resource URL
GET /addresses/default/

cURL Example

  1. curl -X POST -H 'Authorization: Token 7dccb47cbeb6a283013708ed983712fc6488aa74'
  2. http://127.0.0.1:8000/account/addresses/default/

JSON Response

  1. {
  2. "default": true,
  3. "linkman": "陈浩南",
  4. "telephone": "12345678",
  5. "shipping_address": "铜锣湾",
  6. "owner": "opSbp2JARhmzgmez9yObTt9aSybs2",
  7. "pk": 3
  8. }

设置默认地址

Method and Url Structure

Method Resource URL
PATCH /addresses/default/&{pk}

Request and Parameters

Name Description Required Default
pk 地址 pk YES

Request

  1. 2

cURL Example

  1. curl -X PATCH -H 'Authorization: Token 7dccb47cbeb6a283013708ed983712fc6488aa74'
  2. http://127.0.0.1:8000/account/addresses/default/2/

JSON Response

  1. {
  2. "pk": 2,
  3. "owner": "opSbp2JARhmzgmez9yObTt9aSybs2",
  4. "linkman": null,
  5. "telephone": null,
  6. "shipping_address": null,
  7. "default": true
  8. }
添加新批注
在作者公开此批注前,只有你和作者可见。
回复批注