创建回复接口

  • 接口说明: 回复主题/回复其他回复
  • 接口地址: /api/posts
  • 请求方式: POST

请求参数

参数名称类型是否必须描述
threadIdint主题 id
replyIdint回复 id
contentstring内容
isCommentbool是否是回复的评论(楼中楼)

请求示例

  1. // 回复主题
  2. {
  3. "data": {
  4. "type": "posts",
  5. "attributes": {
  6. "content": "{{$randomWords}} == {{$randomColor}} == {{$randomWords}}",
  7. },
  8. "relationships": {
  9. "thread": {
  10. "data": {
  11. "type": "threads",
  12. "id": "4"
  13. }
  14. },
  15. "attachments": {
  16. "data": [
  17. {
  18. "type": "attachments",
  19. "id": 1
  20. },
  21. {
  22. "type": "attachments",
  23. "id": 2
  24. }
  25. ]
  26. }
  27. }
  28. }
  29. }
  30. // 回复其它回复
  31. {
  32. "data": {
  33. "type": "posts",
  34. "attributes": {
  35. "replyId": 33,
  36. "content": "{{$randomWords}} == {{$randomColor}} == {{$randomWords}}",
  37. "is_comment": true
  38. },
  39. "relationships": {
  40. "thread": {
  41. "data": {
  42. "type": "threads",
  43. "id": "4"
  44. }
  45. }
  46. }
  47. }
  48. }

返回说明

  • 成功,http 状态码 201
  • 失败,http 状态码 500

返回结果

参数名称类型出现要求描述
dataobject基础数据
typestring数据类型
idint数据 id
attributesobject数据属性
attributes.summarystring摘要
attributes.contentstring内容
attributes.contentHtmlstringhtml 内容
attributes.ipstring发布 ip
attributes.replyCountint回复数
attributes.likeCountint喜欢数
attributes.createdAtdatetime创建时间
attributes.updatedAtdatetime修改时间
attributes.deletedAtdatetime在回收站时删除时间
attributes.isFirstbool是否首帖
attributes.isApprovedbool是否合法(0/1/2)
0 不合法
1 正常
2 忽略
attributes.isLikedbool是否喜欢
attributes.isommentbool是否是回复回帖的内容(楼中楼)
relationshipsobject关联关系
includedobject关联数据

返回示例

  1. {
  2. "data": {
  3. "type": "Posts",
  4. "id": "33",
  5. "attributes": {
  6. "content": "Savings Account clicks-and-mortar == salmon == Ohio bus Investment Account Bulgarian Lev",
  7. "ip": "127.0.0.1",
  8. "replyCount": null,
  9. "likeCount": null,
  10. "createdAt": "2019-11-13T14:30:54+08:00",
  11. "updatedAt": "2019-11-13T14:30:54+08:00",
  12. "isFirst": false,
  13. "isApproved": false,
  14. "isLiked": false,
  15. "isomment": false
  16. },
  17. "relationships": {
  18. "user": {
  19. "data": {
  20. "type": "users",
  21. "id": "1"
  22. }
  23. },
  24. "thread": {
  25. "data": {
  26. "type": "Threads",
  27. "id": "4"
  28. }
  29. }
  30. }
  31. },
  32. "included": [
  33. {
  34. "type": "users",
  35. "id": "1",
  36. "attributes": {
  37. "username": "username",
  38. "nickname": null,
  39. "mobile": "",
  40. "unionId": "",
  41. "lastLoginIp": "127.0.0.1",
  42. "createdAt": "2019-10-11T00:00:00+08:00",
  43. "updatedAt": "2019-11-11T14:51:34+08:00"
  44. }
  45. },
  46. {
  47. "type": "Threads",
  48. "id": "4",
  49. "attributes": {
  50. "title": "",
  51. "price": "0.00",
  52. "viewCount": 0,
  53. "postCount": 2,
  54. "likeCount": 0,
  55. "createdAt": "2019-11-12T17:10:40+08:00",
  56. "updatedAt": "2019-11-13T14:30:54+08:00",
  57. "isApproved": true,
  58. "isSticky": false,
  59. "isEssence": false,
  60. "isFavorite": false
  61. }
  62. }
  63. ]
  64. }