[关闭]
@fuyb1986 2017-05-11T11:05:00.000000Z 字数 1962 阅读 601

店铺评价

金色童年


获取店铺评价列表

Method and URL Structure

Method Resource URL
GET /shop/evaluation/${shop pk}/

Request Paramaters

Name Description Defalut
page 页码 1
page_size 每页条目 10

cURL Example

  1. curl -H 'Authorization: Token 9944b09199c62bcf9418ad846dd0e4bbdfc6ee4b'\ http://localhost/shop/evaluation/1234/?page=3&page_size=8

Response

  1. {
  2. u'count': 8,
  3. u'previous': http://localhost/shop/evaluation/1234/?page=2&page_size=8,
  4. u'next': http://localhost/shop/evaluation/1234/?page=4&page_size=8,
  5. u'results': [{
  6. u'owner': {
  7. u'owner': 25,
  8. u'slogan': u"xiaoming's slogan",
  9. u'avatar_url': u'http://www.example.com/xiaoming.jpg',
  10. u'nickname': u'xiaoming'
  11. },
  12. u'pk': 3,
  13. u'scores': 5,
  14. u'shop': 5,
  15. u'text': u'\u5317\u65b9\u6709\u4f73\u4eba\uff0c\u4e00\u7b11\u503e\u4eba\u57ce\u3002'
  16. },.... ],
  17. }

提交评价

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

  1. {
  2. "product_socres": 5,
  3. "service_socres": 5,
  4. "deliver_socres": 5,
  5. "text": "北方有佳人,一笑倾人城",
  6. }

cURL Example

  1. curl -X POST -H 'Authorization: Token 9944b09199c62bcf9418ad846dd0e4bbdfc6ee4b'\
  2. -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

  1. {
  2. "pk":3,
  3. "owner": {
  4. "owner":25,
  5. "nickname":"xiaoming",
  6. "avatar_url":"http://www.example.com/xiaoming.jpg",
  7. "slogan":"xiaoming's slogan"
  8. },
  9. "shop":5,
  10. "text":"北方有佳人,一笑倾人城。",
  11. "product_socres": 5,
  12. "service_socres": 5,
  13. "deliver_socres": 5,
  14. }

获取一个评价详情

Method and URL Structure

Method Resource URL Descrtipion
GET /shop/evaluation/${evaluation pk}/

cURL Example

  1. 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

  1. {
  2. "pk":3,
  3. "owner": {
  4. "owner":25,
  5. "nickname":"xiaoming",
  6. "avatar_url":"http://www.example.com/xiaoming.jpg",
  7. "slogan":"xiaoming's slogan"
  8. },
  9. "shop":5,
  10. "text":"北方有佳人,一笑倾人城。",
  11. "product_socres": 5,
  12. "service_socres": 5,
  13. "deliver_socres": 5,
  14. }
添加新批注
在作者公开此批注前,只有你和作者可见。
回复批注