https://xxxxxx/v4/openim/query_online_status?sdkappid=88888888&identifier=admin&usersig=xxx&random=99999999&contenttype=json
Parameter | Description |
https | The request protocol is HTTPS, and the request method is POST. |
xxxxxx | The country/region where your SDKAppID is located. China: console.tim.qq.com Singapore: adminapisgp.im.qcloud.com Seoul: adminapikr.im.qcloud.com Frankfurt: adminapiger.im.qcloud.com Silicon Valley: adminapiusa.im.qcloud.com Jakarta: adminapiidn.im.qcloud.com |
v4/openim/query_online_status | The request API that is used. |
sdkappid | The SDKAppID assigned via the IM console when the application is created. |
identifier | |
usersig | The signature generated by the app admin account. For more information on the operation, see Generating UserSig. |
random | The value must be a random 32-bit unsigned integer. Value range: 0 to 4294967295. |
contenttype | Request format. The value is always json . |
{"To_Account":["id1","id2","id3","id4"],}
{"IsNeedDetail": 1,"To_Account": ["id1", "id2", "id4"]}
Field | Type | Property | Description |
To_Account | Array | Required | The one or more UserIDs whose login statuses are to be queried. This API can be used to query the login statuses of up to 500 UserIDs at a time. |
IsNeedDetail | Integer | Optional | Specifies whether detailed login platform information is needed in the response. 0: not needed. 1: needed. |
{"ActionStatus":"OK","ErrorInfo":"","ErrorCode": 0"QueryResult": [{"To_Account": "id1","State": "Offline"},{"To_Account": "id2","State": "Online"},{"To_Account": "id3","State": "PushOnline"}],"ErrorList": [{"To_Account": "id4","ErrorCode": 70107}]}
{"ActionStatus":"OK","ErrorInfo":"","ErrorCode": 0"QueryResult": [{"To_Account": "id1","State": "Online","Detail": [{"Platform": "IPhone","Status": "PushOnline"},{"Platform": "Web","Status": "Online"}]},{"To_Account": "id2","State": "Offline",}],"ErrorList": [{"To_Account": "id4","ErrorCode": 70107}]}
{"ActionStatus": "FAIL","ErrorInfo": "Fail to Parse json data of body, Please check it","ErrorCode": 90001}
Field | Type | Description |
ActionStatus | String | The processing result of the request. OK: succeeded. FAIL: failed. |
ErrorInfo | String | Detailed information on the error. |
ErrorCode | Integer | The error code returned for the request. If the status query for any account succeed, the value is 0. If the query for all the accounts failed, the return value is not 0. |
QueryResult | Array | The returned structured information of the login status of the user. |
QueryResult.To_Account | String | The UserID of the user whose status is returned. |
QueryResult.Status | String | The returned login status. Valid values: Online: after the user logs in to the client, the client remains in a persistent connection with the IM backend. PushOnline: the client enters the PushOnline state when the iOS or Android process is disconnected due to a network error or is killed by the operating system. In this state, the client still can receive offline messages. However, if the client’s process is not terminated by the operating system after the client is switched to the background, the client is in Online state. Offline: the user has logged out of the client properly or has not logged in to the client for at least 7 days since the last login. If the user logs in to the client on multiple devices, the value is Online provided that the client is in the Online state on any device. |
QueryResult.Detail | Object | The detailed information on the login platform. |
QueryResult.Detail.Platform | String | The type of the login platform. Valid values: "iPhone", "Android", "Web", "PC", "iPad", and "Mac". |
ErrorList | Array | The list of accounts whose statuses failed to be queried. The target accounts in this list were not found or their statuses failed to be queried. If the status query for all accounts succeeded, the value of the ErrorList field is blank. |
ErrorList.To_Account | String | The target account whose status failed to be queried. |
ErrorList.ErrorCode | Integer | The error code indicating that the status query failed. If the error code for a target account is 70107, the account was not found. |
Error Code | Description |
70107 | The requested UserID does not exist. |
70169 | The server timed out. Try again later. |
90001 | JSON format parsing failed. Check whether the request packet meets the JSON specification, or whether To_Account is a null array. |
90003 | The value of the To_Account field in the JSON format request packet does not meet the message format requirements. Please check whether the type of the To_Account field is String. |
90009 | The request requires the app admin’s permissions. |
90011 | The number of target accounts to which the message is to be sent exceeds 500. Reduce the number of target accounts in To_Account. |
90992 | The backend service timed out. Please try again. |
90994 | An internal service error occurred. Please try again. |
90995 | An internal service error occurred. Please try again. |
91000 | An internal service error occurred. Please try again. |
この記事はお役に立ちましたか?