收货地址
好热闹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
{ "linkman": "陈浩南", "telephone": "12345678", "shipping_address": "铜锣湾", "default": true}
cURL Example
curl -X POST -H 'Authorization: Token 7dccb47cbeb6a283013708ed983712fc6488aa74'http://127.0.0.1:8000/account/address_create/
JSON Response
{ "pk": 3, "owner": "opSbp2JARhmzgmez9yObTt9aSybs2", "linkman": "陈浩南", "telephone": "12345678", "shipping_address": "铜锣湾", "default": true}
查看收货地址
Method and Url Structure
| Method |
Resource URL |
| GET |
/account/addresses/ |
cURL Example
curl -X POST -H 'Authorization: Token 7dccb47cbeb6a283013708ed983712fc6488aa74'http://127.0.0.1:8000/account/addresses/
JSON Response
{ "count": 2, "next": null, "previous": null, "results": [ { "pk": 3, "owner": "opSbp2JARhmzgmez9yObTt9aSybs2", "linkman": "陈浩南", "telephone": "12345678", "shipping_address": "铜锣湾", "default": true }, { "pk": 2, "owner": "opSbp2JARhmzgmez9yObTt9aSybs2", "linkman": null, "telephone": null, "shipping_address": null, "default": false } ]}
查看地址详情
Method and Url Structure
| Method |
Resource URL |
| GET |
/account/addresses/ |
Request and Parameters
| Name |
Description |
Required |
Default |
| pk |
ok |
YES |
|
Request
3
cURL Example
curl -X POST -H 'Authorization: Token 7dccb47cbeb6a283013708ed983712fc6488aa74'http://127.0.0.1:8000/account/addresses/3/
JSON Response
{ "pk": 3, "owner": "opSbp2JARhmzgmez9yObTt9aSybs2", "linkman": "陈浩南", "telephone": "12345678", "shipping_address": "铜锣湾", "default": true}
查看默认地址
Method and Url Structure
| Method |
Resource URL |
| GET |
/addresses/default/ |
cURL Example
curl -X POST -H 'Authorization: Token 7dccb47cbeb6a283013708ed983712fc6488aa74'http://127.0.0.1:8000/account/addresses/default/
JSON Response
{ "default": true, "linkman": "陈浩南", "telephone": "12345678", "shipping_address": "铜锣湾", "owner": "opSbp2JARhmzgmez9yObTt9aSybs2", "pk": 3}
设置默认地址
Method and Url Structure
| Method |
Resource URL |
| PATCH |
/addresses/default/&{pk} |
Request and Parameters
| Name |
Description |
Required |
Default |
| pk |
地址 pk |
YES |
|
Request
2
cURL Example
curl -X PATCH -H 'Authorization: Token 7dccb47cbeb6a283013708ed983712fc6488aa74'http://127.0.0.1:8000/account/addresses/default/2/
JSON Response
{ "pk": 2, "owner": "opSbp2JARhmzgmez9yObTt9aSybs2", "linkman": null, "telephone": null, "shipping_address": null, "default": true}