获取用户在线状态
云通讯平台为开发者提供了获取用户在线状态的接口,开发者调用该接口可以在服务器端获取到用户的在线状态。
1、请求地址
- POST /{SoftVersion}/Application/{appId}/IM/GetUserState
2、请求包头
请参阅《鉴权说明》
3、请求包体
属性 | 类型 | 约束 | 说明 |
bodyType | String | 必选 | 包体类型 |
userAccounts | List | 必选 | 用户账号信息,最多100个 |
4、请求示例
- POST/2013-12-26/Application/1234567890ertyui/IM/GetUserState?sig=155EAA68C5DFB6B762A42D88F406ABCD
- HTTP/1.1
- Host: 192.168.0.1:8883
- Accept:application/json;
- Content-Type:application/json;charset=utf-8;
- Authorization:ZmY4MDgwODEzYzM3ZGE1MzAxM2M4MDRmODA3MjAwN2M6MjAxMzAyMDExNTABCDE=
- {"bodyType":"json","userAccounts ":["123456789","987654321","12345421"]}
5、响应包体
属性 | 类型 | 约束 | 说明 |
statusCode | String | 必选 | 请求状态码,取值000000(成功)。 |
userStates | List | 可选 | 返回结果集 |
userAccount | String | List不为空时必选 | 用户账号 |
deviceType | String | List不为空时必选 | 1: Android Phone 2: iPhone 10: iPad 11: Android Pad 20: PC (Just Allowed phone 2 PC(Pad) login) 21: H5 22: MAC |
networkType | String | List不为空时必选 | 1: WIFI 2: 4G 3: 3G 5: 2G(EDGE) 6: other |
state | String | List不为空时必选 | 1:在线 2:离线 |
4.1、响应示例
- HTTP/1.1 200 OK
- Content-Length: 28
- {"statusCode":"000000","userStates":[{"userAccount":"123456789","deviceType":"2","networkType":"1","state":"1"}]}