目录

普通群聊对比无限群聊

普通群聊 无限群聊
人数 <= 500 人数无限
支持在线/离线消息 支持在线消息,不支持离线消息
需成员邀请 可随意加入

群组管理

参数列表

Variable Meanings
$appId 小米开放平台申请的AppId
$appKey 小米开放平台申请的AppKey
$appSecret 小米开放平台申请的AppSecret
$topicId 表示群ID
$topicName 表示创建群的时候所指定的群名称
$topicId1 表示查询所属群信息时用户所加入群的群ID
$topicId2 表示查询所属群信息时用户所加入群的群ID
$topicName1 表示查询所属群信息时用户所加入群的群名称
$ownerUuid 表示群主在MIMC账号系统内uuid(可使用user.getUuid()获取)
$ownerAccount 表示群主在APP账号系统内唯一ID
$ownerToken 表示群主token(可使用user.getToken()获取)
$userAccount1 表示群成员1号在APP账号系统内唯一ID
$userUuid1 表示userAccount1在MIMC账号系统内uuid(可使用user.getUuid()获取)
$userToken1 表示userAccount1的token(可使用user.getToken()获取)
$memberNum 表示查询群的成员数量
$userCnt 表示在线人数
$isEnd 表示拉取群组成员时,是否是最后一批,拉取群成员是批量查询
$startUuid 表示起始的uuid,初始表示0,后续批量查询以此来作为起始uuid。
$extra 群消息自定义字段,开发者自行定义,最大不超过10kb 非必填
身份认证有两种方式:
    1. token验证,适用于客户端访问,token可通过User.getToken()获取
    2. appId/appKey/appSecret验证,适用于服务端访问
注意:
以下所有的http接口中,如果传入的appAccount是-H参数且含有中文,那么就需要做下面两件事(不含中文则不需要):
(1)将appAccount进行base64编码之后再传入;
(2)需要加上下面的appAccountEncode参数,表示对appAccount进行了base64编码;
     -H "appAccountEncode:base64"

创建群

创建群后,$ownerAccount会加入到群组里,无须再加群
  • HTTPS 请求

    curl "https://mimc.chat.xiaomi.net/api/uctopic" -XPOST
     -d '{"topicName":$topicName,"extra":$extra}'
     -H "Content-Type: application/json"
     -H "token:$token"
    
    curl "https://mimc.chat.xiaomi.net/api/uctopic" -XPOST
     -d '{"topicName":$topicName,"extra":$extra}'
     -H "Content-Type: application/json"
     -H "appId:$appId"
     -H "appKey:$appKey"
     -H "appSecret:$appSecret"
     -H "appAccount:$ownerAccount"
    
  • JSON结果
    {
      "code":200,
      "message":"success",
      "data":{
          "topicId":$topicId,
          "ownerUuid":$ownerUuid,
          "topicName":$topicName,
          "extra":$extra
      }
    }
    

    更新群

    更新群,topicId必填,其他参数必填一个;
    必须群主才能转让群,更新群信息,转让群主需要被转让用户在群中;
    
  • HTTPS 请求

    curl "https://mimc.chat.xiaomi.net/api/uctopic/update" -XPOST
     -d '{"topicId":$topicId,"topicName":$topicName,"ownerAccount":$ownerAccount,"extra":$extra}'
     -H "Content-Type: application/json"
     -H "token:$token"
    
    curl "https://mimc.chat.xiaomi.net/api/uctopic/update" -XPOST
     -d '{"topicId":$topicId,"topicName":$topicName,"ownerAccount":$ownerAccount,"extra":$extra}'
     -H "Content-Type: application/json"
     -H "appId:$appId"
     -H "appKey:$appKey"
     -H "appSecret:$appSecret"
     -H "appAccount:$appAccount"
    
  • JSON结果
    {
      "code":200,
      "message":"success",
      "data":{
          "topicId":$topicId,
          "ownerUuid":$ownerUuid,
          "ownerAccount":$ownerAccount,
          "topicName":$topicName,
          "extra":$extra
      }
    }
    

删除群

删除群,topicId必填
必须群主才能删除群;
  • HTTPS 请求

    curl "https://mimc.chat.xiaomi.net/api/uctopic" -XDELETE
     -H "Content-Type: application/json"
     -H "topicId:$topicId"
     -H "token:$token"
    
    curl "https://mimc.chat.xiaomi.net/api/uctopic" -XDELETE
     -H "Content-Type: application/json"
     -H "topicId:$topicId"
     -H "appId:$appId"
     -H "appKey:$appKey"
     -H "appSecret:$appSecret"
    
  • JSON结果
    {"code":200,"message":"success","data":null}
    

    查询群成员

为了避免超大群成员过多,每次最多返回一百个,以uuid大小排序。
startUuid 可以不写,默认为0。isEnd表示本次查询,成员是否是最后一批。
  • HTTPS请求
curl "https://mimc.chat.xiaomi.net/api/uctopic/userlist" -XGET
  -H "Content-Type: application/json"
  -H "token:$userToken1"
  -H "topicId:$topicId"
  -H "startUuid:$startUuid"

curl "https://mimc.chat.xiaomi.net/api/uctopic/userlist" -XGET
  -H "Content-Type: application/json"
  -H "appId:$appId"
  -H "appKey:$appKey"
  -H "appSecret:$appSecret"
  -H "topicId:$topicId"
  -H "startUuid:$startUuid"
  • JSON结果
{
    "code":200,
    "message":"success",
    "data":{
        "count": "$count",
        "members":[
            {
                "appAccout":"$userAccount1",
                "uuid":"$userUuid1",
                "appId":"$appId"
            },
            {
                "appAccout":"$userAccount2",
                "uuid":"$userUuid2",
                "appId":"$appId"
            }
        ],
        "isEnd":"$isEnd"
    }
}

查询所属群

  • HTTPS请求
curl "https://mimc.chat.xiaomi.net/api/uctopic/topics" -XGET
  -H "Content-Type: application/json"
  -H "token:$userToken1"

curl "https://mimc.chat.xiaomi.net/api/uctopic/topics" -XGET
  -H "Content-Type: application/json"
  -H "appId:$appId"
  -H "appKey:$appKey"
  -H "appSecret:$appSecret"
  -H "appAccount:$userAccount1"
  • JSON结果
{
    "code":200,
    "message":"success",
    "data":[$topicId1, $topicId2]
}

查询群基本信息

返回创建者的uuid和appAcount,群组名称,成员总数, 群组Id
  • HTTPS请求
curl "https://mimc.chat.xiaomi.net/api/uctopic/topic" -XGET
  -H "Content-Type: application/json"
  -H "token:$userToken1"
  -H "topicId:$topicId"

curl "https://mimc.chat.xiaomi.net/api/uctopic/topic" -XGET
  -H "Content-Type: application/json"
  -H "appId:$appId"
  -H "appKey:$appKey"
  -H "appSecret:$appSecret"
  -H "topicId:$topicId"
  • JSON结果
{
    "code":200,
    "message":"success",
    "data":
    {
        "topicId":"$topicId",
        "topicName":"$topicName",
        "ownerUuid":"$ownerUuid",
        "ownerAccount":"$ownerAccount",
        "memberNum":"$memberNum"
     }
 }

查询群在线人数

并不限定只能查询自己的群组,所有的群组都可查看
  • HTTPS请求
curl "https://mimc.chat.xiaomi.net/api/uctopic/onlineinfo" -XGET
  -H "Content-Type: application/json"
  -H "token:$userToken1"
  -H "topicId:$topicId"

curl "https://mimc.chat.xiaomi.net/api/uctopic/onlineinfo" -XGET
  -H "Content-Type: application/json"
  -H "appId:$appId"
  -H "appKey:$appKey"
  -H "appSecret:$appSecret"
  -H "topicId:$topicId"
  • JSON结果
{
    "code":200,
    "message":"success",
    "data":
    {
        "topicId":"$topicId",
        "userCnt":"$userCnt"
     }
 }

禁止群成员发消息

群主可以禁止群内成员发送消息
  • HTTPS请求
curl "https://mimc.chat.xiaomi.net/api/uctopic/forbidsendmsg" -XPOST
  -H "Content-Type: application/json"
  -H "token:$userToken1"
  -d '{"topicId":"$topicid","user":"$user", "forbidSeconds":$seconds}' 

curl "https://mimc.chat.xiaomi.net/api/uctopic/forbidsendmsg" -XPOST
  -H "Content-Type: application/json"
  -H "appId:$appId"
  -H "appKey:$appKey"
  -H "appSecret:$appSecret"
  -d '{"topicId":"$topicid","user":"$user", "forbidSeconds":$seconds}'
  • 参数说明
    • topicId : 无限大群id
    • user : 被禁言用户
    • forbidSeconds : 禁言时间(秒),如果传0则相当于取消禁言。最多可以禁言315360000秒(十年)
  • JSON结果
{
    "code":200,
    "message":"success",
    "data":""
 }

接口调整

联系我们,给我们提出需求,我们可快速提供对应调整

回到顶部

results matching ""

    No results matching ""