Showing
1 changed file
with
214 additions
and
0 deletions
环信添加好友系列接口.md
0 → 100644
1 | +####班级同学建立好友关系接口 | ||
2 | + | ||
3 | +接口地址: /buildFriendship/class?access_token=ASLDFKJIWE | ||
4 | + | ||
5 | +请求方式:GET | ||
6 | + | ||
7 | +参数:user_id (用户id) | ||
8 | + | ||
9 | +**返回值:** | ||
10 | + | ||
11 | +1.该用户没有加入任何班级 | ||
12 | + | ||
13 | +```json | ||
14 | +{ | ||
15 | + "message": "该用户没有加入班级" | ||
16 | +} | ||
17 | +``` | ||
18 | + | ||
19 | +2.成功建立好友关系 | ||
20 | +```json | ||
21 | +{ | ||
22 | + "message": "success" | ||
23 | +} | ||
24 | +``` | ||
25 | + | ||
26 | +---------------------------------- | ||
27 | + | ||
28 | +####搜索好友接口 | ||
29 | + | ||
30 | +接口地址: /search/friend | ||
31 | + | ||
32 | +请求方式:GET | ||
33 | + | ||
34 | +参数: | ||
35 | +|参数 |是否必须 |说明 | | ||
36 | +|---------------|--------|--------------| | ||
37 | +|keyWord |是 |搜索关键字 | | ||
38 | +|currentPage |否 |分页,当前页,从0开始,默认为0| | ||
39 | + | ||
40 | +**返回值:** | ||
41 | +```json | ||
42 | +[ | ||
43 | + { | ||
44 | + "easemob_nickname": "愿那些年幸福的预兆只是个玩笑", | ||
45 | + "user_type": "STUDENT", | ||
46 | + "nickname": "愿那些年幸福的预兆只是个玩笑", | ||
47 | + "easemob_username": "5de6f7a36339ef5bedc3dc8741a1e222", | ||
48 | + "id": 12938, | ||
49 | + "username": "447900226@qq.com", | ||
50 | + "realname": "愿那些年幸福", | ||
51 | + "figure_url": "http://avatars.boxfish.cn/user/12938/figure/1423708364.jpg" | ||
52 | + }, | ||
53 | + { | ||
54 | + "easemob_nickname": "447900227@qq.com", | ||
55 | + "user_type": "STUDENT", | ||
56 | + "nickname": null, | ||
57 | + "easemob_username": "0bbeaf0242180c8abffb2b8dada5a9e4", | ||
58 | + "id": 13463, | ||
59 | + "username": "447900227@qq.com", | ||
60 | + "realname": null, | ||
61 | + "figure_url": "http://avatars.boxfish.cn/user/13463/figure/1411345608.jpg" | ||
62 | + }, | ||
63 | + { | ||
64 | + "easemob_nickname": "Fei", | ||
65 | + "user_type": "STUDENT", | ||
66 | + "nickname": null, | ||
67 | + "easemob_username": "2b8ed17fbe7858c641d55ca03eb8ace3", | ||
68 | + "id": 13465, | ||
69 | + "username": "447900228@qq.com", | ||
70 | + "realname": "Fei", | ||
71 | + "figure_url": "http://avatars.boxfish.cn/user/13465/figure/1411346930.jpg" | ||
72 | + } | ||
73 | +] | ||
74 | +``` | ||
75 | + | ||
76 | +------------------------- | ||
77 | + | ||
78 | + | ||
79 | +####添加单个好友接口 | ||
80 | + | ||
81 | +接口地址:/buildFriendship/add | ||
82 | + | ||
83 | +请求方式:POST | ||
84 | + | ||
85 | +参数: | ||
86 | +|参数 | 是否必须 |说明 | | ||
87 | +|---------|-----------|----------------| | ||
88 | +|user_id |是 |被添加好友的用户id| | ||
89 | +|message |否 |申请理由 | | ||
90 | + | ||
91 | +**返回值:** | ||
92 | +1.添加自己为好友 | ||
93 | +```json | ||
94 | +{ | ||
95 | + "message": "您不能添加自己为好友" | ||
96 | +} | ||
97 | +``` | ||
98 | + | ||
99 | +2.对方已经是你的好友 | ||
100 | +```json | ||
101 | +{ | ||
102 | + "message": "对方已是您的好友" | ||
103 | +} | ||
104 | +``` | ||
105 | +3.发送成功 | ||
106 | +```json | ||
107 | +{ | ||
108 | + "message": "申请成功,请等待回复。" | ||
109 | +} | ||
110 | +``` | ||
111 | + | ||
112 | +------------------------ | ||
113 | + | ||
114 | +####删除好友接口 | ||
115 | + | ||
116 | +接口地址:/buildFriendship/delete | ||
117 | + | ||
118 | +请求方式:DELETE | ||
119 | + | ||
120 | +参数:user_id (被删除的好友的id) | ||
121 | + | ||
122 | +**返回值:** | ||
123 | + | ||
124 | +1.删除成功 | ||
125 | +```json | ||
126 | +{ | ||
127 | + "message": "success" | ||
128 | +} | ||
129 | +``` | ||
130 | +2.删除失败 | ||
131 | +```json | ||
132 | +{ | ||
133 | + "message": "failed" | ||
134 | +} | ||
135 | +``` | ||
136 | + | ||
137 | +---------------------- | ||
138 | +####修改好友备注接口 | ||
139 | + | ||
140 | +接口地址:/buildFriendship/alias | ||
141 | + | ||
142 | +请求方式:POST | ||
143 | + | ||
144 | +参数: | ||
145 | +|参数 |是否必须 | 说明 | | ||
146 | +|-------|-----------|--------------| | ||
147 | +|user_id|是 |被修改的用户的id| | ||
148 | +|alias |是 |备注名称 | | ||
149 | +**返回值:** | ||
150 | +1.设置成功 | ||
151 | +```json | ||
152 | +{ | ||
153 | + "message": "success" | ||
154 | +} | ||
155 | +``` | ||
156 | +2.设置失败 | ||
157 | +```json | ||
158 | +{ | ||
159 | + "message": "failed" | ||
160 | +} | ||
161 | +``` | ||
162 | + | ||
163 | +-------------------------- | ||
164 | +####同意添加好友接口 | ||
165 | + | ||
166 | +接口地址:/buildFriendship/{user}/{status} | ||
167 | + | ||
168 | +请求方式:POST | ||
169 | + | ||
170 | +参数: | ||
171 | + | ||
172 | +|参数 |是否必须 |说明 | | ||
173 | +|-----------|-----------|---------------| | ||
174 | +|{user} |是 |用户id | | ||
175 | +|{status} |是 |同意或拒绝,只能是accept或reject| | ||
176 | +|message |否 |拒绝理由 | | ||
177 | + | ||
178 | + | ||
179 | +####获取通讯录接口(非新接口) | ||
180 | + | ||
181 | +接口地址:/user/relationship/easemob | ||
182 | + | ||
183 | +请求方式:GET | ||
184 | + | ||
185 | +参数: | ||
186 | +|参数 |是否必须 |说明 | | ||
187 | +|-------------|-----------------|----------------------| | ||
188 | +|type |否 |默认为"STUDENT" | | ||
189 | +|flag |否(默认为true) |返回值是否包含班级好友的标志:默认为true,表示返回值包含班级好友| | ||
190 | +**返回值:** | ||
191 | +```json | ||
192 | +[ | ||
193 | + { | ||
194 | + "id": 61727, | ||
195 | + "username": "544043963@qq.com", | ||
196 | + "nickname": "gang", | ||
197 | + "easemob_username": "b8c1ca2bded145de5e4533ae4f9b3b35", | ||
198 | + "type": "friend", | ||
199 | + "user_type": "TEACHER", | ||
200 | + "friend_from":"class", | ||
201 | + "alias": "jack" | ||
202 | + }, | ||
203 | + { | ||
204 | + "id": 2, | ||
205 | + "username": "teacher", | ||
206 | + "real_name": "老师", | ||
207 | + "easemob_username": "c81e728d9d4c2f636f067f89cc14862c", | ||
208 | + "type": "friend", | ||
209 | + "user_type": "TEACHER", | ||
210 | + "friend_from":"class", | ||
211 | + "alias": "rose" | ||
212 | + } | ||
213 | +] | ||
214 | +``` |
-
Please register or login to post a comment