查询主题接口[列表]

  • 接口说明: 查询主题[列表]
  • 接口地址: /api/threads
  • 请求方式: GET

请求参数

参数名称类型是否必须描述
includestring关联数据
filter[q]string关键词
filter[userId]int作者 id
filter[username]string作者用户名
filter[categoryId]int分类 id
filter[createdAtBegin]datetime发表时间大于
filter[createdAtEnd]datetime发表时间小于
filter[viewCountGt]int浏览次数大于
filter[viewCountLt]int浏览次数小于
filter[postCountGt]int回复数大于
filter[postCountLt]int回复数小于
filter[isEssence]string是否精华(yes/no)
filter[isSticky]string是否置顶(yes/no)
filter[isApproved]string是否合法(0/1/2)
0 不合法
1 正常
2 忽略
filter[isDeleted]string是否删除(yes/no)
filter[likedLimit]int点赞首帖的用户返回数量
filter[rewardedLimit]int打赏主题的用户返回数量
filter[paidLimit]int付费主题的已购用户返回数量
filter[highlight]string是否高亮敏感词(yes/no)
filter[fromUserId]int关注人 userId(会验证是否为当前登录用户)
filter[type]int类型:0 普通 1 长文 2 视频 3 图片 4 语音 5 问答帖 6 商品帖
filter[topicId]int话题 ID
filter[location]string附近的帖,格式:经度,纬度[,距离](距离可不传,默认 5km,如 116.397469,39.908821)
filter[isSite]string是否推荐到站点信息页(yes/no)

include 可关联的数据

关联名称模型类型是否默认描述
userusersobject发表用户
firstPostpostsobject首帖
threadVideothread-videoobject视频
lastPostedUserusersobject最后回复用户
categorycategoriesobject主题分类
user.groupsgroupsobject用户所在群组
deletedUserusersobject删除用户
firstPost.imagesattachmentsarray首贴图片
firstPost.likedUsersusersarray点赞首帖的用户
lastThreePostspostsarray最后三条回复
lastThreePosts.userusersobject最后三条回复的作者
lastThreePosts.replyUserusersobject最后三条回复所回复的用户
rewardedUsersusersarray打赏主题的用户
paidUsersusersarray付费主题的已购用户
lastDeletedLogoperation-logsobject最后一次被删除的操作日志
topictopicsobject主题话题
questionquestionobject问答内容
question.beUserquestionobject关联问答内容的被回答人信息

请求示例

  1. /api/threads?include=user,firstPost,lastThreePosts,lastThreePosts.user&page[number]=1

返回说明

  • 成功,http 状态码: 200
  • 失败,http 状态码: 404

返回结果

关联数据模型字段释义参见请参见相应文档

参数名称类型出现要求描述
linksobject接口链接
dataobject基础数据
typestring数据类型
idint数据 id
attributesobject数据属性
typeint文章类型(0 普通 1 长文 2 视频)
titlestring长文主题标题
pricefloat长文主题主题价格
attachment_pricefloat附件价格
viewCountint查看数
postCountint帖子数
paidCountint付费数
rewardedCountint打赏数
createdAtdatetime创建时间
updatedAtdatetime修改时间
deletedAtdatetime在回收站时删除时间
isApprovedbool是否合法(0/1/2)
0 不合法
1 正常
2 忽略
isStickybool是否置顶
isEssencebool是否加精
isFavoritebool已收藏时是否收藏
isSitebool是否推荐到站点信息页
paidbool付费主题是否付费
isPaidAttachmentbool付费附件附件是否付费
canViewPostsbool是否有权查看详情
canReplybool是否有权回复
canApprovebool是否有权审核
canStickybool是否有权置顶
canEssencebool是否有权加精
canDeletebool是否有权永久删除
canHidebool是否有权放入回收站
canFavoritebool是否有权收藏
relationshipsobject关联关系
includedobject关联数据
question_answer.be_user_idint回答人的用户ID
question_answer.contentstring回答的内容
question_answer.content_htmlstring回答的html 内容
question_answer.ipstring回答人的IP
question_answer.portint回答人的端口
question_answer.pricefloat问答单价
question_answer.onlooker_unit_pricefloat围观单价
question_answer.onlooker_pricefloat围观总价格
question_answer.onlooker_numberint围观总人数
question_answer.is_onlookerbool是否允许围观 true允许 false不允许
question_answer.is_answerint是否已回答 0未回答 1已回答 2已过期
question_answer.expired_atstring问答过期时间

返回示例

  1. {
  2. "links": {
  3. "first": "DummySiteUrl/api/threads?page%5Blimit%5D=10",
  4. "last": "DummySiteUrl/api/threads?page%5Blimit%5D=10"
  5. },
  6. "data": [
  7. {
  8. "type": "threads",
  9. "id": "26",
  10. "attributes": {
  11. "type": 0,
  12. "title": "",
  13. "price": "0.00",
  14. "attachment_price": "0.00",
  15. "viewCount": 0,
  16. "postCount": 1,
  17. "createdAt": "2020-03-10T16:33:24+08:00",
  18. "updatedAt": "2020-03-10T16:33:24+08:00",
  19. "isApproved": 1,
  20. "isSticky": false,
  21. "isEssence": false,
  22. "canViewPosts": true,
  23. "canReply": true,
  24. "canApprove": true,
  25. "canSticky": true,
  26. "canEssence": true,
  27. "canDelete": true,
  28. "canHide": true,
  29. "canFavorite": true
  30. },
  31. "relationships": {
  32. "user": {
  33. "data": {
  34. "type": "users",
  35. "id": "3"
  36. }
  37. },
  38. "firstPost": {
  39. "data": {
  40. "type": "posts",
  41. "id": "24"
  42. }
  43. },
  44. "lastPostedUser": {
  45. "data": {
  46. "type": "users",
  47. "id": "3"
  48. }
  49. },
  50. "category": {
  51. "data": {
  52. "type": "categories",
  53. "id": "1"
  54. }
  55. }
  56. }
  57. },
  58. {
  59. "type": "threads",
  60. "id": "25",
  61. "attributes": {
  62. "type": 2,
  63. "title": "",
  64. "price": "0.00",
  65. "viewCount": 1,
  66. "postCount": 1,
  67. "createdAt": "2020-03-10T16:31:54+08:00",
  68. "updatedAt": "2020-03-10T16:31:54+08:00",
  69. "isApproved": 1,
  70. "isSticky": false,
  71. "isEssence": false,
  72. "canViewPosts": true,
  73. "canReply": true,
  74. "canApprove": true,
  75. "canSticky": true,
  76. "canEssence": true,
  77. "canDelete": true,
  78. "canHide": true,
  79. "canFavorite": true
  80. },
  81. "relationships": {
  82. "user": {
  83. "data": {
  84. "type": "users",
  85. "id": "3"
  86. }
  87. },
  88. "firstPost": {
  89. "data": {
  90. "type": "posts",
  91. "id": "23"
  92. }
  93. },
  94. "threadVideo": {
  95. "data": {
  96. "type": "thread-video",
  97. "id": "18"
  98. }
  99. },
  100. "lastPostedUser": {
  101. "data": {
  102. "type": "users",
  103. "id": "3"
  104. }
  105. },
  106. "category": {
  107. "data": {
  108. "type": "categories",
  109. "id": "1"
  110. }
  111. }
  112. }
  113. }
  114. ],
  115. "included": [
  116. {
  117. "type": "users",
  118. "id": "3",
  119. "attributes": {
  120. "id": 3,
  121. "username": "username",
  122. "avatarUrl": "",
  123. "threadCount": 19,
  124. "followCount": 0,
  125. "fansCount": 0,
  126. "follow": null,
  127. "status": 0,
  128. "loginAt": "2020-03-10T11:20:42+08:00",
  129. "joinedAt": "2020-03-09T16:39:28+08:00",
  130. "expiredAt": null,
  131. "createdAt": "2020-03-09T16:39:28+08:00",
  132. "updatedAt": "2020-03-10T17:03:44+08:00",
  133. "canEdit": true,
  134. "canDelete": true,
  135. "registerReason": "",
  136. "banReason": "",
  137. "originalMobile": "",
  138. "registerIp": "127.0.0.1",
  139. "lastLoginIp": "127.0.0.1",
  140. "identity": "",
  141. "realname": "",
  142. "mobile": "",
  143. "canWalletPay": false,
  144. "walletBalance": "0.00"
  145. }
  146. },
  147. {
  148. "type": "posts",
  149. "id": "24",
  150. "attributes": {
  151. "replyUserId": null,
  152. "content": "abc",
  153. "contentHtml": "abc",
  154. "replyCount": 0,
  155. "likeCount": 0,
  156. "createdAt": "2020-03-10T16:33:24+08:00",
  157. "updatedAt": "2020-03-10T16:33:24+08:00",
  158. "isFirst": true,
  159. "isApproved": 1,
  160. "canEdit": true,
  161. "canApprove": true,
  162. "canDelete": true,
  163. "canHide": true,
  164. "ip": "127.0.0.1",
  165. "canLike": true
  166. }
  167. },
  168. {
  169. "type": "posts",
  170. "id": "23",
  171. "attributes": {
  172. "replyUserId": null,
  173. "content": "abc",
  174. "contentHtml": "abc",
  175. "replyCount": 0,
  176. "likeCount": 0,
  177. "createdAt": "2020-03-10T16:31:54+08:00",
  178. "updatedAt": "2020-03-10T16:31:54+08:00",
  179. "isFirst": true,
  180. "isApproved": 1,
  181. "canEdit": true,
  182. "canApprove": true,
  183. "canDelete": true,
  184. "canHide": true,
  185. "ip": "127.0.0.1",
  186. "canLike": true
  187. }
  188. },
  189. {
  190. "type": "categories",
  191. "id": "1",
  192. "attributes": {
  193. "name": "默认分类",
  194. "description": "默认分类",
  195. "icon": "",
  196. "sort": 0,
  197. "property": 0,
  198. "thread_count": 19,
  199. "ip": "127.0.0.1",
  200. "created_at": "2020-03-05T09:41:41+08:00",
  201. "updated_at": "2020-03-10T17:03:44+08:00"
  202. }
  203. },
  204. {
  205. "type": "thread-video",
  206. "id": "18",
  207. "attributes": {
  208. "id": 18,
  209. "user_id": 3,
  210. "thread_id": 25,
  211. "status": 1,
  212. "reason": "source file err: file info lack width, height or color space",
  213. "file_name": "666",
  214. "file_id": "666",
  215. "width": 666,
  216. "height": 666,
  217. "media_url": "url",
  218. "cover_url": "url",
  219. "updated_at": "2020-03-10T18:26:31+08:00",
  220. "created_at": "2020-03-10T16:31:54+08:00"
  221. }
  222. },
  223. {
  224. "type": "question_answer",
  225. "id": "1",
  226. "attributes": {
  227. "thread_id": 201,
  228. "user_id": 4,
  229. "be_user_id": 1,
  230. "content": "",
  231. "content_html": null,
  232. "ip": "",
  233. "port": 0,
  234. "price": "10.00",
  235. "onlooker_unit_price": "2.00",
  236. "onlooker_price": "0.00",
  237. "onlooker_number": 0,
  238. "is_onlooker": true,
  239. "is_answer": 0,
  240. "is_approved": 1,
  241. "created_at": "2020-09-16T11:10:47+08:00",
  242. "updated_at": "2020-09-16T11:10:47+08:00",
  243. "expired_at": "2020-09-23T00:00:00+08:00"
  244. }
  245. }
  246. ],
  247. "meta": {
  248. "threadCount": 2,
  249. "pageCount": 1
  250. }
  251. }