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
{
"username":"username",
"password":"password",
}
cURL Example
curl http://www.haorenao.cn/im/user_get_token/
JSON Response
Name |
Description |
ret |
标识是否成功。ok, 成功; failed, 失败 |
reason |
失败原因 |
token |
用户 token |
{
"ret": "ok",
"reason": "",
"token": "fYFO429vmoFQ0DButRaXStAsHUJMj7YH5n0doxN8TQmLggkgGKPwMt7Vn9XEzapD/0YrepuLnmECETGdwNAT+7Oxjg/xj0sI",
}
获取用户信息
Description
获取用户信息
Method and URL Structure
Method |
Resource URL |
GET |
/cmd/?cmd=get_userinfo |
Request Parameters
Name |
Description |
Required |
Default |
username |
用户名 |
YES |
|
Request
{
"username":"username",
}
cURL Example
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 |
|
{
"ret": "ok",
"reason": "",
"username": "18516271364",
"nickname": "9527",
"desc": "desc",
"thumb": "resource.haorenao.cn/static/tea/threadimages/xx1.png",
"expert_status": 0,
"point": "1335",
"is_public_number": false,
"is_admin":false,
"yue": 0,
"jifen": 0,
}
管理员创建群组
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
{
"username":"username",
"password":"password",
"name", "group_name",
}
cURL Example
curl http://www.haorenao.cn/im/group_create/
JSON Response
Name |
Description |
ret |
标识是否成功。ok, 成功; failed, 失败 |
reason |
失败原因 |
group_id |
新创建的 group ID |
{
"ret": "ok",
"reason": "",
"group_id":123,
}
解散群组
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
curl http://www.haorenao.cn/im/11/group_dismiss/
JSON Response
Name |
Description |
ret |
标识是否成功。ok, 成功; failed, 失败 |
reason |
失败原因 |
{
"ret": "ok",
"reason": "",
}
加入群组
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
curl http://www.haorenao.cn/im/11/group_join/
JSON Response
Name |
Description |
ret |
标识是否成功。ok, 成功; failed, 失败 |
reason |
失败原因 |
{
"ret": "ok",
"reason": "",
}
退出群组
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
curl http://www.haorenao.cn/im/11/group_quit/
JSON Response
Name |
Description |
ret |
标识是否成功。ok, 成功; failed, 失败 |
reason |
失败原因 |
{
"ret": "ok",
"reason": "",
}
获取群组信息
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
curl http://www.haorenao.cn/im/11/group_get_info/
JSON Response
Name |
Description |
ret |
标识是否成功。ok, 成功; failed, 失败 |
reason |
失败原因 |
group_id |
用户名 |
group_name |
群组名称 |
{
"ret": "ok",
"reason": "",
"group_id":1234,
"group_name": u"群组名称",
}
获取群组成员列表
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
{
"username":"username",
"password":"password",
}
cURL Example
curl http://www.haorenao.cn/im/11/group_get_user_list/
JSON Response
Name |
Description |
ret |
标识是否成功。ok, 成功; failed, 失败 |
reason |
失败原因 |
group_id |
用户名 |
group_name |
群组名称 |
userinfos |
群成员列表 |
{
"ret": "ok",
"reason": "",
"group_id":1234,
"group_name": u"群组名称",
"userinfos": [
{
"username": "18516271364",
"nickname": "9527",
"thumb": "resource.haorenao.cn/static/tea/threadimages/xx1.png",
}, ....
],
}
获取用户加入的群组列表
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
{
"username":"username",
"password":"password",
}
cURL Example
curl http://www.haorenao.cn/im/user_get_group_list/
JSON Response
Name |
Description |
ret |
标识是否成功。ok, 成功; failed, 失败 |
reason |
失败原因 |
groups |
群组列表 |
id |
群 id |
name |
群组名称 |
{
"ret": "ok",
"reason": "",
"groups": [
{
"id": 1234,
"name": u"我的测试群",
}, ....
],
}
同步用户加入的群组
Description
同步用户加入的群组
Method and URL Structure
Method |
Resource URL |
POST |
/im/group_sync/ |
Request Parameters
Name |
Description |
Required |
Default |
username |
用户名 |
YES |
|
password |
用户密码 |
YES |
|
Request
{
"username":"username",
"password":"password",
}
cURL Example
curl http://www.haorenao.cn/im/group_sync/
JSON Response
Name |
Description |
ret |
标识是否成功。ok, 成功; failed, 失败 |
reason |
失败原因 |
{
"ret": "ok",
"reason": "",
}
获取客服信息
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
{
"username":"username",
"password":"password",
}
cURL Example
curl http://www.haorenao.cn/im/customer_service_get_info/
JSON Response
Name |
Description |
ret |
标识是否成功。ok, 成功; failed, 失败 |
reason |
失败原因 |
id |
客服公众号 id |
name |
客服公众号昵称 |
token |
用户 token |
{
"ret": "ok",
"reason": "",
"id":"haorenao_cs_001",
"name":u"客服",
"token":"token",
}