通用API

1. 创建/更新频道

频道是一种一对多的关系,类似于微信公众号,使用server api创建完频道后,可以使用channel api进行对接业务系统。

1.0.1. 地址

http://domain:18080/admin/channel/create

1.0.2. body

参数 类型 必需 描述
owner string 频道拥有者
name string 频道名称
targetId string 频道ID,如果传空,系统会自动生成一个用户id
callback string 频道消息回调地址
portrait string 频道头像
auto int 0,owner会接收到消息,如果配置callback同时会转发消息;1,owner不会接收消息,如果配置callback会转发消息到callback
desc string 描述信息
state int 频道权限
secret string 频道密钥,如果为空系统会自动生成
extra string 附加信息

1.0.3. 响应

参数 类型 必需 描述
targetId string 频道ID
secret string 频道密钥

如果创建时不填写secret,会自动生成一个

1.0.4. 示例

curl -X POST -H "nonce:76616" -H "timestamp":"1558350862502" -H "sign":"b98f9b0717f59febccf1440067a7f50d9b31bdde" -H "Content-Type:application/json" -d "{\"name\":\"a\",\"callback\":\"http://localhost/admin\",\"owner\":\"b\"}" http://localhost:18080/admin/channel/create

{
  "code":0,
  "msg":"success",
  "result":{
    "targetId":"a",
    "secret":"xxxxx"
  }
}

2. 创建/更新机器人

创建/更新机器人

3. 设置用户设置

仅专业版IM服务支持此接口,用户设置相关知识请参考基础知识-用户设置。使用此接口时需要慎重。

3.0.1. 地址

http://domain:18080/admin/user/put_setting

3.0.2. body

参数 类型 必需 描述
userId string 用户ID
scope int 设置类型
key string 设置的Key值
value string 设置的Value

3.0.3. 响应

N/A

3.0.4. 示例

curl -X POST -H "nonce:76616" -H "timestamp":"1558350862502" -H "sign":"b98f9b0717f59febccf1440067a7f50d9b31bdde" -H "Content-Type:application/json" -d "{\"userId\":\"a\",\"scope\":1001,\"key\":\"b\",\"value\":\"c\"}" http://localhost:18080/admin/user/put_setting

{
  "code":0,
  "msg":"success",
  "result":{
  }
}

4. 获取用户设置

仅专业版IM服务支持此接口,用户设置相关知识请参考基础知识-用户设置

4.0.1. 地址

http://domain:18080/admin/user/get_setting

4.0.2. body

参数 类型 必需 描述
userId string 用户ID
scope int 设置类型
key string 设置的Key值

4.0.3. 响应

参数 类型 必需 描述
userId string 用户ID
scope int 设置类型
key string 设置的Key值
value string 设置的Value

4.0.4. 示例

curl -X POST -H "nonce:76616" -H "timestamp":"1558350862502" -H "sign":"b98f9b0717f59febccf1440067a7f50d9b31bdde" -H "Content-Type:application/json" -d "{\"userId\":\"a\",\"scope\":1001,\"key\":\"b\",\"value\":\"c\"}" http://localhost:18080/admin/user/get_setting

{
  "code":0,
  "msg":"success",
  "result":{
    \"userId\":\"a\",
    \"scope\":1001,
    \"key\":\"b\",
    \"value\":\"c\"
  }
}
2018 © wildfirechat.net 京ICP备18060403号-1 all right reserved,powered by Gitbook该文件修订时间: 2025-04-01 03:45:26

results matching ""

    No results matching ""