[关闭]
@fuyb1986 2016-03-19T05:47:00.000000Z 字数 4753 阅读 780

IM 文档

好热闹


获取用户 token

Description

获取用户 token

Method and URL Structure

Method Resource URL
POST /im/user_get_token/

Request Parameters

Name Description Required Default
username 用户名 YES
password 密码 YES

Request

  1. {
  2. "username":"username",
  3. "password":"password",
  4. }

cURL Example

  1. curl http://www.haorenao.cn/im/user_get_token/

JSON Response

Name Description
ret 标识是否成功。ok, 成功; failed, 失败
reason 失败原因
token 用户 token
  1. {
  2. "ret": "ok",
  3. "reason": "",
  4. "token": "fYFO429vmoFQ0DButRaXStAsHUJMj7YH5n0doxN8TQmLggkgGKPwMt7Vn9XEzapD/0YrepuLnmECETGdwNAT+7Oxjg/xj0sI",
  5. }

获取用户信息

Description

获取用户信息

Method and URL Structure

Method Resource URL
GET /cmd/?cmd=get_userinfo

Request Parameters

Name Description Required Default
username 用户名 YES

Request

  1. {
  2. "username":"username",
  3. }

cURL Example

  1. curl http://www.haorenao.cn/cmd/?cmd=get_userinfo&username=12345678

JSON Response

Name Description
ret 标识是否成功。ok, 成功; failed, 失败
reason 失败原因
username 用户名
nickanme 用户昵称
desc 用户简介
thumb 用户头像
expert_status 是否达人
point 积分
is_public_number 是否公众号
is_admin 是否管理员
yue
  1. {
  2. "ret": "ok",
  3. "reason": "",
  4. "username": "18516271364",
  5. "nickname": "9527",
  6. "desc": "desc",
  7. "thumb": "resource.haorenao.cn/static/tea/threadimages/xx1.png",
  8. "expert_status": 0,
  9. "point": "1335",
  10. "is_public_number": false,
  11. "is_admin":false,
  12. "yue": 0,
  13. "jifen": 0,
  14. }

管理员创建群组

Description

管理员创建群组

Method and URL Structure

Method Resource URL
POST /im/group_create/

Request Parameters

Name Description Required Default
username 用户名 YES
password 用户密码 YES
name 群组名 YES

Request

  1. {
  2. "username":"username",
  3. "password":"password",
  4. "name", "group_name",
  5. }

cURL Example

  1. curl http://www.haorenao.cn/im/group_create/

JSON Response

Name Description
ret 标识是否成功。ok, 成功; failed, 失败
reason 失败原因
group_id 新创建的 group ID
  1. {
  2. "ret": "ok",
  3. "reason": "",
  4. "group_id":123,
  5. }

解散群组

Description

解散群组

Method and URL Structure

Method Resource URL
POST /im/${group id}/group_dismiss/

Request Parameters

Name Description Required Default
username 用户名 YES
password 用户密码 YES

Request

cURL Example

  1. curl http://www.haorenao.cn/im/11/group_dismiss/

JSON Response

Name Description
ret 标识是否成功。ok, 成功; failed, 失败
reason 失败原因
  1. {
  2. "ret": "ok",
  3. "reason": "",
  4. }

加入群组

Description

加入群组

Method and URL Structure

Method Resource URL
POST /im/${group id}/group_join/

Request Parameters

Name Description Required Default
username 用户名 YES
password 用户密码 YES

Request

cURL Example

  1. curl http://www.haorenao.cn/im/11/group_join/

JSON Response

Name Description
ret 标识是否成功。ok, 成功; failed, 失败
reason 失败原因
  1. {
  2. "ret": "ok",
  3. "reason": "",
  4. }

退出群组

Description

退出群组

Method and URL Structure

Method Resource URL
POST /im/${group id}/group_quit/

Request Parameters

Name Description Required Default
username 用户名 YES
password 用户密码 YES

Request

cURL Example

  1. curl http://www.haorenao.cn/im/11/group_quit/

JSON Response

Name Description
ret 标识是否成功。ok, 成功; failed, 失败
reason 失败原因
  1. {
  2. "ret": "ok",
  3. "reason": "",
  4. }

获取群组信息

Description

获取群组信息

Method and URL Structure

Method Resource URL
GET /im/${group id}/group_get_info/

Request Parameters

Name Description Required Default
group id 群组 ID YES

Request

cURL Example

  1. curl http://www.haorenao.cn/im/11/group_get_info/

JSON Response

Name Description
ret 标识是否成功。ok, 成功; failed, 失败
reason 失败原因
group_id 用户名
group_name 群组名称
  1. {
  2. "ret": "ok",
  3. "reason": "",
  4. "group_id":1234,
  5. "group_name": u"群组名称",
  6. }

获取群组成员列表

Description

获取群组成员列表

Method and URL Structure

Method Resource URL
POST /im/${gorup id}/group_get_user_list/

Request Parameters

Name Description Required Default
username 用户名 YES
password 用户密码 YES
group id 群组 ID YES

Request

  1. {
  2. "username":"username",
  3. "password":"password",
  4. }

cURL Example

  1. curl http://www.haorenao.cn/im/11/group_get_user_list/

JSON Response

Name Description
ret 标识是否成功。ok, 成功; failed, 失败
reason 失败原因
group_id 用户名
group_name 群组名称
userinfos 群成员列表
  1. {
  2. "ret": "ok",
  3. "reason": "",
  4. "group_id":1234,
  5. "group_name": u"群组名称",
  6. "userinfos": [
  7. {
  8. "username": "18516271364",
  9. "nickname": "9527",
  10. "thumb": "resource.haorenao.cn/static/tea/threadimages/xx1.png",
  11. }, ....
  12. ],
  13. }

获取用户加入的群组列表

Description

获取用户加入的群组列表

Method and URL Structure

Method Resource URL
POST /im/user_get_group_list/

Request Parameters

Name Description Required Default
username 用户名 YES
password 用户密码 YES

Request

  1. {
  2. "username":"username",
  3. "password":"password",
  4. }

cURL Example

  1. curl http://www.haorenao.cn/im/user_get_group_list/

JSON Response

Name Description
ret 标识是否成功。ok, 成功; failed, 失败
reason 失败原因
groups 群组列表
id 群 id
name 群组名称
  1. {
  2. "ret": "ok",
  3. "reason": "",
  4. "groups": [
  5. {
  6. "id": 1234,
  7. "name": u"我的测试群",
  8. }, ....
  9. ],
  10. }

同步用户加入的群组

Description

同步用户加入的群组

Method and URL Structure

Method Resource URL
POST /im/group_sync/

Request Parameters

Name Description Required Default
username 用户名 YES
password 用户密码 YES

Request

  1. {
  2. "username":"username",
  3. "password":"password",
  4. }

cURL Example

  1. curl http://www.haorenao.cn/im/group_sync/

JSON Response

Name Description
ret 标识是否成功。ok, 成功; failed, 失败
reason 失败原因
  1. {
  2. "ret": "ok",
  3. "reason": "",
  4. }

获取客服信息

Description

发起客服聊天前,客服帐号信息以及用户的 token.

Method and URL Structure

Method Resource URL
POST /im/customer_service_get_info/

Request Parameters

Name Description Required Default
username 用户名 YES
password 用户密码 YES

Request

  1. {
  2. "username":"username",
  3. "password":"password",
  4. }

cURL Example

  1. curl http://www.haorenao.cn/im/customer_service_get_info/

JSON Response

Name Description
ret 标识是否成功。ok, 成功; failed, 失败
reason 失败原因
id 客服公众号 id
name 客服公众号昵称
token 用户 token
  1. {
  2. "ret": "ok",
  3. "reason": "",
  4. "id":"haorenao_cs_001",
  5. "name":u"客服",
  6. "token":"token",
  7. }
添加新批注
在作者公开此批注前,只有你和作者可见。
回复批注