用户信息
金色童年
获取个人信息
Method and URL Structure
Method |
Resource URL |
GET |
/account/whoami/ |
Request Paramaters
No Applicatated
cURL Example
curl -H 'Authorization: Token 9944b09199c62bcf9418ad846dd0e4bbdfc6ee4b'\ http://localhost/account/whoami/
Response Data
Name |
Description |
nickname |
昵称 |
avatar_url |
头像地址 |
slogan |
个性签名 |
address |
地址 |
name |
姓名 |
sex |
性别 |
point |
积分 |
is_shop |
是否店铺用户 |
balance_info |
余额信息 |
rong_token |
容云 token |
Response
{
"pk": 3,
"owner": "13245678910"
"nickname":"xiaoming",
"avatar_url":"http://www.example.com/xiaoming.jpg",
"slogan":"xiaoming's slogan",
"address":u'南柯郡汶汶乡大槐树',
"point": 100,
"name": "小明",
"sex": "M",
"sex_display": "男",
"is_shop": false,
"balance_info":{
"pk":19,
"amount":"0.00",
"created":"2016-10-31T19:03:38.727343"
},
"rong_token": "uyAyfXD+GoQAP7B0r0U9YIJMl53hXLqp+BdK3WLlazk5uKpsTQMXG+8YXGNlZduChHCZE8g+G3Kt5N9sCx9/yZsc1hvUzHw5"
}
更新个人信息
使用 PUT 更新信息,就算某个字段没有更新,也要传递给接口
使用 PATCH 更新信息,可以更新其中一个或多个
Method and URL Structure
Method |
Resource URL |
Descrtipion |
PUT |
/account/whoami/ |
更新所有字段 |
PATCH |
/account/whoami/ |
更新部分字段 |
Request Data
Name |
Description |
Required |
Default |
nickname |
昵称 |
YES |
|
avatar_url |
头像地址 |
YES |
|
slogan |
个性签名 |
YES |
|
address |
地址 |
YES |
|
name |
姓名 |
YES |
|
sex |
性别 |
YES |
|
sex data
Name |
Description |
M |
男 |
F |
女 |
S |
保密 |
Request
{
"nickname":"新昵称",
"avatar_url":"http://www.example.com/test001.jpg",
"slogan":"xiaoming's slogan",
"address":u'南柯郡汶汶乡大槐树',
"name": "小明",
"sex": "M",
}
cURL Example
curl -X PUT -H 'Authorization: Token 9944b09199c62bcf9418ad846dd0e4bbdfc6ee4b'\
-H 'Content-Type: Application/json' --data '{....}' http://localhost/account/whoami/
{
"nickname":"新昵称",
"avatar_url":"http://www.example.com/test001.jpg",
"slogan":"xiaoming's slogan",
"address":u'南柯郡汶汶乡大槐树',
"point": 100,
"name": "小明",
"sex": "M",
"sex_display": "男",
}
获取其他用户的公开信息
Method and URL Structure
Method |
Resource URL |
GET |
/account/pepole/${username}/ |
cURL Example
curl -H 'Authorization: Token 9944b09199c62bcf9418ad846dd0e4bbdfc6ee4b'\ http://localhost/account/pepole/1324567890/
Response
{
"pk": 3,
"owner": "13245678910"
"nickname":"xiaoming",
"avatar_url":"http://www.example.com/xiaoming.jpg",
"slogan":"xiaoming's slogan",
"name": "小明",
"sex": "M",
"sex_display": "男",
}
获取照片和赞的数据
Method and URL Structure
Method |
Resource URL |
GET |
/account/photo_stat/ |
Request Paramaters
No Applicatated
cURL Example
curl -H 'Authorization: Token 9944b09199c62bcf9418ad846dd0e4bbdfc6ee4b'\ http://localhost/account/photo_stat/
Reponse Data
Name |
Description |
photo_count |
照片数量 |
album_count |
相册数量 |
photo_like_count |
照片的赞总和 |
Response
{
"photo_count":0,
"album_count":0,
"photo_like_count":0
}