[关闭]
@fuyb1986 2016-10-09T09:49:44.000000Z 字数 1179 阅读 515

消息

金色童年


获取未读消息

Method and URL Structure

Method Resource URL Description
GET /messages/inbox/ inbox 里的所有消息
GET /messages/inbox/{id}/ 单条消息

Request Paramaters

No Applicatated

cURL Example

  1. curl -H 'Authorization: Token 9944b09199c62bcf9418ad846dd0e4bbdfc6ee4b'\ http://localhost/messages/inbox/

Reponse Data

Name Description
id id
message 消息文本
level DEBUG, INFO ...
tags 标签,可以视为类型
date 发消息的时间
url 附加的 url

Response

  1. [
  2. {
  3. "id": "1",
  4. "message": "Hello,World",
  5. "level": 21,
  6. "tags": "",
  7. "date": "2016-10-09T17:35:38.763",
  8. "url": null
  9. },
  10. {
  11. "id": "2",
  12. "message": "你好世界",
  13. "level": 21,
  14. "tags": "",
  15. "date": "2016-10-09T17:37:32.162",
  16. "url": null
  17. },
  18. {
  19. "id": "3",
  20. "message": "你好世界",
  21. "level": 21,
  22. "tags": "system",
  23. "date": "2016-10-09T17:37:38.353",
  24. "url": null
  25. }
  26. ]

让消息变成已读

已读后inbox 里看不到了

Method and URL Structure

Method Resource URL Descrtipion
POST /messages/inbox/${id}/read 单条消息已读
POST /messages/mark_all_read/ 所有消息已读

cURL Example

  1. curl -X POST -H 'Authorization: Token 9944b09199c62bcf9418ad846dd0e4bbdfc6ee4b'\ http://localhost/messages/inbox/3/read/

未读消息数量

已读后inbox 里看不到了

Method and URL Structure

Method Resource URL Descrtipion
GET /messages/inbox_count/ 未读消息数量

cURL Example

  1. curl -H 'Authorization: Token 9944b09199c62bcf9418ad846dd0e4bbdfc6ee4b'\ http://localhost/messages/inbox_count/

Reponse

  1. {
  2. "count": 2, # 未读条数
  3. "status": 0,
  4. "message": ""
  5. }
添加新批注
在作者公开此批注前,只有你和作者可见。
回复批注