店铺评价
金色童年
获取店铺评价列表
Method and URL Structure
Method |
Resource URL |
GET |
/shop/evaluation/${shop pk}/ |
Request Paramaters
Name |
Description |
Defalut |
page |
页码 |
1 |
page_size |
每页条目 |
10 |
cURL Example
curl -H 'Authorization: Token 9944b09199c62bcf9418ad846dd0e4bbdfc6ee4b'\ http://localhost/shop/evaluation/1234/?page=3&page_size=8
Response
{
u'count': 8,
u'previous': http://localhost/shop/evaluation/1234/?page=2&page_size=8,
u'next': http://localhost/shop/evaluation/1234/?page=4&page_size=8,
u'results': [{
u'owner': {
u'owner': 25,
u'slogan': u"xiaoming's slogan",
u'avatar_url': u'http://www.example.com/xiaoming.jpg',
u'nickname': u'xiaoming'
},
u'pk': 3,
u'scores': 5,
u'shop': 5,
u'text': u'\u5317\u65b9\u6709\u4f73\u4eba\uff0c\u4e00\u7b11\u503e\u4eba\u57ce\u3002'
},.... ],
}
提交评价
Method and URL Structure
Method |
Resource URL |
Descrtipion |
POST |
/shop/evaluation/${sho pk}/ |
|
Request Data
Name |
Description |
Required |
Default |
product_scores |
评分 1-5 |
YES |
|
service_scores |
评分 1-5 |
YES |
|
deliver_scores |
评分 1-5 |
YES |
|
text |
评论文字 |
YES |
|
Request
{
"product_socres": 5,
"service_socres": 5,
"deliver_socres": 5,
"text": "北方有佳人,一笑倾人城",
}
cURL Example
curl -X POST -H 'Authorization: Token 9944b09199c62bcf9418ad846dd0e4bbdfc6ee4b'\
-H 'Content-Type: Application/json' --data '{....}' http://localhost/shop/evaluation/1234/
Response Data
Name |
Description |
product_scores |
评分 1-5 |
service_scores |
评分 1-5 |
deliver_scores |
评分 1-5 |
text |
评论文字 |
owner |
店铺信息 |
Response
{
"pk":3,
"owner": {
"owner":25,
"nickname":"xiaoming",
"avatar_url":"http://www.example.com/xiaoming.jpg",
"slogan":"xiaoming's slogan"
},
"shop":5,
"text":"北方有佳人,一笑倾人城。",
"product_socres": 5,
"service_socres": 5,
"deliver_socres": 5,
}
获取一个评价详情
Method and URL Structure
Method |
Resource URL |
Descrtipion |
GET |
/shop/evaluation/${evaluation pk}/ |
|
cURL Example
curl http://localhost/shop/evaluation/99999/
Reponse Data
Name |
Description |
product_scores |
评分 1-5 |
service_scores |
评分 1-5 |
deliver_scores |
评分 1-5 |
text |
评论文字 |
owner |
店铺信息 |
Response
{
"pk":3,
"owner": {
"owner":25,
"nickname":"xiaoming",
"avatar_url":"http://www.example.com/xiaoming.jpg",
"slogan":"xiaoming's slogan"
},
"shop":5,
"text":"北方有佳人,一笑倾人城。",
"product_socres": 5,
"service_socres": 5,
"deliver_socres": 5,
}