获取关注列表

  • 接口说明: 获取关注列表
  • 接口地址: /api/follow
  • 请求方式: GET

请求参数

参数名称类型是否必须描述
includestring关联数据
filter[type]int类型(1 我的关注 2 我的粉丝)
filter[user_id]int用户 ID,不传默认获取当前登陆用户
filter[username]string用户名模糊查询
page[number]int页码
page[limit]int单页数量

include 可关联的数据

关联名称模型类型是否默认描述
toUserusersobject关注用户,配合 type=1 使用
fromUserusersobject粉丝用户,配合 type=2 使用
fromUser.groupsgroupsobject粉丝的用户组
toUser.groupsgroupsobject关注的用户组

请求示例

  1. /api/follow?filter[type]=1&page[number]=1&page[limit]=10&include=fromUser

返回说明

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

返回结果

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

字段名变量名必填类型描述
linksobjectobject接口链接
data.attributesobjectobject数据属性
自增 idattribute.idstring自增 id
关注人attribute.from_user_idint关注人 uid
被关注人attribute.to_user_idint被关注人 uid
互相关注attribute.is_mutualint是否互相关注:0 否 1 是
更新时间attributes.updated_atdatetime更新时间
创建时间attributes.created_atdatetime创建时间
data.relationshipsobjectobject关联关系
includedobjectobject关联数据

返回示例

  1. {
  2. "links": {
  3. "first": "DummySiteUrl/api/follow?filter%5Btype%5D=1&page%5Blimit%5D=10&include=toUser",
  4. "last": "DummySiteUrl/api/follow?filter%5Btype%5D=1&page%5Blimit%5D=10&include=toUser"
  5. },
  6. "data": [
  7. {
  8. "type": "user_follow",
  9. "id": "37",
  10. "attributes": {
  11. "id": 37,
  12. "from_user_id": 1,
  13. "to_user_id": 3,
  14. "is_mutual": 0,
  15. "updated_at": "2020-02-06T19:52:14+08:00",
  16. "created_at": "2020-01-10T14:12:49+08:00"
  17. },
  18. "relationships": {
  19. "toUser": {
  20. "data": {
  21. "type": "users",
  22. "id": "3"
  23. }
  24. }
  25. }
  26. },
  27. {
  28. "type": "user_follow",
  29. "id": "38",
  30. "attributes": {
  31. "id": 38,
  32. "from_user_id": 1,
  33. "to_user_id": 4,
  34. "is_mutual": 0,
  35. "updated_at": "2020-02-06T19:52:14+08:00",
  36. "created_at": "2020-01-10T14:12:52+08:00"
  37. },
  38. "relationships": {
  39. "toUser": {
  40. "data": {
  41. "type": "users",
  42. "id": "4"
  43. }
  44. }
  45. }
  46. },
  47. {
  48. "type": "user_follow",
  49. "id": "39",
  50. "attributes": {
  51. "id": 39,
  52. "from_user_id": 1,
  53. "to_user_id": 5,
  54. "is_mutual": 0,
  55. "updated_at": "2020-02-06T19:52:14+08:00",
  56. "created_at": "2020-01-10T14:12:55+08:00"
  57. },
  58. "relationships": {
  59. "toUser": {
  60. "data": {
  61. "type": "users",
  62. "id": "5"
  63. }
  64. }
  65. }
  66. },
  67. {
  68. "type": "user_follow",
  69. "id": "56",
  70. "attributes": {
  71. "id": 56,
  72. "from_user_id": 1,
  73. "to_user_id": 2,
  74. "is_mutual": 1,
  75. "updated_at": "2020-02-06T19:52:14+08:00",
  76. "created_at": "2020-02-06T19:52:14+08:00"
  77. },
  78. "relationships": {
  79. "toUser": {
  80. "data": {
  81. "type": "users",
  82. "id": "2"
  83. }
  84. }
  85. }
  86. }
  87. ],
  88. "included": [
  89. {
  90. "type": "users",
  91. "id": "3",
  92. "attributes": {
  93. "id": 3,
  94. "username": "username",
  95. "mobile": "",
  96. "avatarUrl": "",
  97. "threadCount": 0,
  98. "followCount": 0,
  99. "fansCount": 0,
  100. "follow": null,
  101. "status": 0,
  102. "loginAt": null,
  103. "joinedAt": "2019-12-20T03:53:54+08:00",
  104. "expiredAt": null,
  105. "createdAt": "2019-12-20T03:53:55+08:00",
  106. "updatedAt": "2019-12-20T03:53:55+08:00",
  107. "canEdit": true,
  108. "canDelete": true,
  109. "registerReason": null,
  110. "originalMobile": "",
  111. "registerIp": "172.16.167.1",
  112. "lastLoginIp": "",
  113. "identity": null,
  114. "realname": null
  115. }
  116. },
  117. {
  118. "type": "users",
  119. "id": "4",
  120. "attributes": {
  121. "id": 4,
  122. "username": "username",
  123. "mobile": "",
  124. "avatarUrl": "",
  125. "threadCount": 0,
  126. "followCount": 0,
  127. "fansCount": 0,
  128. "follow": null,
  129. "status": 0,
  130. "loginAt": null,
  131. "joinedAt": "2019-12-19T15:33:23+08:00",
  132. "expiredAt": null,
  133. "createdAt": "2019-12-19T15:33:23+08:00",
  134. "updatedAt": "2020-01-02T16:37:51+08:00",
  135. "canEdit": true,
  136. "canDelete": true,
  137. "registerReason": null,
  138. "originalMobile": "",
  139. "registerIp": "172.16.167.1",
  140. "lastLoginIp": "172.16.167.1",
  141. "identity": null,
  142. "realname": null
  143. }
  144. },
  145. {
  146. "type": "users",
  147. "id": "5",
  148. "attributes": {
  149. "id": 5,
  150. "username": "username",
  151. "mobile": "",
  152. "avatarUrl": "",
  153. "threadCount": 0,
  154. "followCount": 0,
  155. "fansCount": 1,
  156. "follow": null,
  157. "status": 0,
  158. "loginAt": null,
  159. "joinedAt": "2019-12-27T18:19:21+08:00",
  160. "expiredAt": null,
  161. "createdAt": "2019-12-27T18:19:21+08:00",
  162. "updatedAt": "2020-01-20T15:53:11+08:00",
  163. "canEdit": true,
  164. "canDelete": true,
  165. "registerReason": null,
  166. "originalMobile": "",
  167. "registerIp": "172.16.167.1",
  168. "lastLoginIp": "",
  169. "identity": null,
  170. "realname": null
  171. }
  172. },
  173. {
  174. "type": "users",
  175. "id": "2",
  176. "attributes": {
  177. "id": 2,
  178. "username": "username",
  179. "mobile": "",
  180. "avatarUrl": "",
  181. "threadCount": 0,
  182. "followCount": 1,
  183. "fansCount": 1,
  184. "follow": null,
  185. "status": 0,
  186. "loginAt": "2020-02-06T19:48:34+08:00",
  187. "joinedAt": "2019-12-20T03:48:09+08:00",
  188. "expiredAt": null,
  189. "createdAt": "2019-12-20T03:48:09+08:00",
  190. "updatedAt": "2020-02-06T19:52:14+08:00",
  191. "canEdit": true,
  192. "canDelete": true,
  193. "registerReason": null,
  194. "originalMobile": "",
  195. "registerIp": "172.16.167.1",
  196. "lastLoginIp": "172.16.167.1",
  197. "identity": null,
  198. "realname": null
  199. }
  200. }
  201. ],
  202. "meta": {
  203. "total": 4,
  204. "size": "10"
  205. }
  206. }