收货地址
金色童年
收货地址列表
Method and URL Structure
Method |
Resource URL |
GET |
/account/addess/ |
Request Paramaters
No Applicated
cURL Example
curl -H 'Authorization: Token 9944b09199c62bcf9418ad846dd0e4bbdfc6ee4b'\ http://localhost/account/shipping_address/
Reponse
{
"count":2,
"next":null,
"previous":null,
"results":[{
"pk": 392,
"province":"上海",
"city":"上海",
"region":"虹桥",
"address":"虹桥火车站",
"telephone": "12345678910",
"default": false,
},{
"pk": 391,
"province":"山东",
"city":"青岛",
"region":"四方",
"address":"四方火车站"
"telephone": "12345678910",
"default": true,
}]
}
增加一个收货地址
Method |
Resource URL |
POST |
/account/address/ |
Request Data
Name |
Description |
province |
省 |
city |
市 |
region |
区 |
address |
详细地址 |
telephone |
电话 |
cURL Example
curl -X POST -H 'Authorization: Token 9944b09199c62bcf9418ad846dd0e4bbdfc6ee4b'\ --data '{...}' http://localhost/account/address/391/
Reponse
{
"pk": 391,
"province":"山东",
"city":"青岛",
"region":"四方",
"address":"无名乡无名村"
"telephone": "12345678910",
"default": false,
}
获取、更新、删除收货地址
Method |
Resource URL |
Description |
GET |
/account/address/${pk}/ |
获取 |
PUT |
/account/address/${pk}/ |
整体更新 |
PATCH |
/account/address/${pk}/ |
部分更新 |
Request Paramaters
No Applicated
cURL Example
curl -X PUT -H 'Authorization: Token 9944b09199c62bcf9418ad846dd0e4bbdfc6ee4b'\ --data '{...}' http://localhost/account/shipping_address/391/
Reponse
{
"pk": 391,
"province":"山东",
"city":"青岛",
"region":"四方",
"address":"无名乡无名村"
"telephone": "12345678910",
"default": false,
}
设置、获取默认收货地址
Method |
Resource URL |
Description |
GET |
/account/address/default/ |
获取默认收货地址 |
PATCH |
/account/address/${pk}/default |
设置默认收货地址 |
Response
{
"pk":8,
"name":"",
"province":"山东",
"city":"青岛",
"region":"四方",
"address":"无名乡无名村",
"linkman":"张三",
"telephone":"12345678910",
"default":true,
}