リストを追加
Feature Overview
This API is used to add a friend list. You can add friend lists in batches and add a specific friend to a friend list.
API Calling Description
Sample request URL
https://xxxxxx/v4/sns/group_add?sdkappid=88888888&identifier=admin&usersig=xxx&random=99999999&contenttype=json
Request parameters
The following table describes the modified parameters when this API is called. For other parameters, see RESTful API Overview.
Parameter | Description |
xxxxxx | Domain name corresponding to 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 |
v4/sns/group_add | Request API |
sdkappid | SDKAppID assigned by the Chat console when an app is created |
identifier | |
usersig | |
random | A random 32-bit unsigned integer ranging from 0 to 4294967295. |
contenttype | Request format, which should always be json . |
Maximum call frequency
200 calls per second
Sample request
Basic format
{"From_Account":"id","GroupName":["group1","group2","group3"]}
Complete format
{"From_Account":"id","GroupName":["group1","group2","group3"],"To_Account":["id1","id2","id3"]}
Request fields
Field | Type | Required | Description |
From_Account | String | Yes | UserID for which a new friend list needs to be added. |
GroupName | Array | Yes | List of new group lists. Note: Since the maximum number of groups is 32, a single request must not exceed 32 groups. |
To_Account | Array | No | UserID list of friends that need to be added to the new group list; a single request must not exceed 1000 friends. |
Sample response
Basic format
{"CurrentSequence": 2,"ActionStatus": "OK","ErrorCode": 0,"ErrorInfo": "","ErrorDisplay": ""}
Complete format
{"ResultItem":[{"To_Account": "id1","ResultCode": 0,"ResultInfo": ""},{"To_Account": "id2","ResultCode": 32216,"ResultInfo": "Err_SNS_GroupAdd_ToTinyId_Not_Friend"},{"To_Account": "id3","ResultCode": 30002,"ResultInfo": "ERR_SDKAPPID_ILLEGAL"}],"Fail_Account":["id2","id3"],"CurrentSequence": 3,"ActionStatus": "OK","ErrorCode": 0,"ErrorInfo": "","ErrorDisplay": ""}
Response fields
Field | Type | Description |
ResultItem | Array | Result object array for adding a friend to a new friend list. |
To_Account | String | UserID of the friend to be added to the new friend list. |
ResultCode | Integer | Result of To_Account . 0 : Successful. Other values: Failed. For details on non-zero results, see Error Codes. |
ResultInfo | String | Error description of To_Account . This field is empty if the request is successful. |
Fail_Account | Array | List of users whose processing failed. This field is only returned when at least one user fails. |
CurrentSequence | Integer | Current sequence of the lists. |
ActionStatus | String | Request result. OK : Successful; FAIL : Failed |
ErrorCode | Integer | |
ErrorInfo | String | Detailed error information. |
ErrorDisplay | String | Detailed information displayed on the client |
Error Codes
The returned HTTP status code for this API is always 200 unless a network error (such as error 502) occurs. The specific error code and details can be found in the response fields
ResultCode
, ResultInfo
, ErrorCode
, and ErrorInfo
.
For public error codes (60000 to 79999), see Error Codes.
The following table describes the error codes specific to this API:Error Code | Description |
30001 | Incorrect request parameter. Check your request according to the error description. |
30002 | The SDKAppID does not match. |
30003 | The requested account does not exist. |
30004 | The request requires app admin permissions. |
30006 | Internal server error. Try again. |
30007 | Network timeout. Try again later. |
30008 | A write conflict occurred due to concurrent write operations. You are advised to use bulk processing. |
30011 | The maximum number of friend lists has been reached. |
API Debugging Tool
References
Deleting Lists (v4/sns/group_delete)