Group Type ID | RESTful API Support |
Private | Yes. Same as work groups (Work) in the new version. |
Public | Yes |
ChatRoom | Yes. Same as meeting groups (Meeting) in the new version. |
AVChatRoom | Yes. To use an audio-video group (AVChatroom), users (including the group owner) must use the SDK to request to join the group. |
Community | Yes |
https://xxxxxx/v4/group_open_http_svc/create_group?sdkappid=88888888&identifier=admin&usersig=xxx&random=99999999&contenttype=json
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 Jakarta: adminapiidn.im.qcloud.com |
v4/group_open_http_svc/create_group | 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 . |
Owner_Account
field is optional. If it is not specified, the group will have no group owner. If you want to specify a group owner, ensure that the UserId of the group owner has been imported.{"Owner_Account": "leckie", // UserId of the group owner (optional)"Type": "Public", // Group type: Private, Public, ChatRoom, AVChatRoom, or Community"Name": "TestGroup" // Group name (required)}
{"Owner_Account": "leckie", // UserId of the group owner (optional)"Type": "Public", // Group type: Private, Public, ChatRoom, AVChatRoom, or Community"Name": "TestGroup", // Group name (required)"Introduction": "This is group Introduction", // Group introduction (optional)"Notification": "This is group Notification", // Group notice (optional)"FaceUrl": "http://this.is.face.url", // Group profile photo URL (optional)"MaxMemberCount": 500, // Maximum number of group members (optional)"ApplyJoinOption": "FreeAccess" // Method for handling requests to join the group (optional)}
Member_Account
and Role
fields can be set.{"Name": "TestGroup", // Group name (required)"Type": "Public", // Group type: Private, Public, ChatRoom, or Community (AVChatRoom is not supported) (required)"MemberList": [ // Initial group member list, which contains a maximum of 100 members (optional){"Member_Account": "bob", // Member (required)"Role": "Admin" // Role assigned to the member (optional). Currently, only the Admin option is available.},{"Member_Account": "peter"}]}
{"Owner_Account": "leckie", // UserId of the group owner (optional)"Type": "Public", // Group type: Private, Public, ChatRoom, AVChatRoom, or Community (required)"GroupId": "MyFirstGroup", // User-defined group ID (optional)"Name": "TestGroup" // Group name (required)}
AppDefineData
field is unavailable by default and needs to be enabled in the Chat console before use. For details, see the request packet field description table.{"Name": "TestGroup", // Group name (required)"Type": "Public", // Group type: Private, Public, ChatRoom, AVChatRoom, or Community (required)"AppDefinedData": [ // Group custom field (optional){"Key": "GroupTestData1", // Key of the app custom field"Value": "xxxxx" // Value of the custom field},{"Key": " GroupTestData2","Value": "abc\\u0000\\u0001" // The custom field supports binary data.}]}
{"Owner_Account": "leckie", // UserId of the group owner (optional)"Type": "Public", // Group type: Private, Public, ChatRoom, or Community (AVChatRoom is not supported) (required)"Name": "TestGroup", // Group name (required)"MemberList": [{"Member_Account":"bob","AppMemberDefinedData":[ // Group member custom field (optional){"Key": "MemberDefined1", // Group member custom key"Value": "MemberData1" // Value of the group member custom field},{"Key": "MemberDefined2","Value": "MemberData2"}]},{"Member_Account":"peter","AppMemberDefinedData":[{"Key": "MemberDefined1","Value": "MemberData1"},{"Key": "MemberDefined2","Value": "MemberData2"}]}]}
{"Type": "Community", // Group type (required)"Name": "TestCommunityGroup", // Group name (required)"SupportTopic": 1 // Whether the topic option is supported. Valid values: `1`: yes; `0`: no.}
{"Owner_Account": "leckie", // UserId of the group owner (optional)"Type": "Public", // Group type: Private, Public, ChatRoom, or Community (AVChatRoom is not supported) (required)"GroupId":"MyFirstGroup", // User-defined group ID (optional)"Name": "TestGroup", // Group name (required)"Introduction": "This is group Introduction", // Group introduction (optional)"Notification": "This is group Notification", // Group notice (optional)"FaceUrl": "http://this.is.face.url", // Group profile photo URL (optional)"MaxMemberCount": 500, // Maximum number of group members (optional)"ApplyJoinOption": "FreeAccess", // Method for handling requests to join the group (optional)"AppDefinedData": [ // Group custom field (optional){"Key": "GroupTestData1", // Key of the app custom field"Value": "xxxxx" // Value of the custom field},{"Key": "GroupTestData2","Value": "abc\\u0000\\u0001" // The custom field supports binary data.}],"MemberList": [ // Initial group member list, which contains a maximum of 100 members (optional){"Member_Account": "bob", // Member (required)"Role": "Admin", // Role assigned to the member. Currently, only the Admin option is available. (optional)"AppMemberDefinedData":[ // Group member custom field (optional){"Key":"MemberDefined1", // Group member custom key"Value":"MemberData1" // Value of the group member custom field},{"Key":"MemberDefined2","Value":"MemberData2"}]},{"Member_Account": "peter","AppMemberDefinedData":[{"Key":"MemberDefined1","Value":"MemberData1"},{"Key":"MemberDefined2","Value":"MemberData2"}]}]}
Field | Type | Required | Description |
Owner_Account | String | Optional | Group owner ID, which must be an imported account. The value will be automatically added to group members. If this field is not specified, the group will have no group owner, and group members need to call the group joining API when using an audio-video group (AVChatroom) group. |
Type | String | Required | Group type, including Public, Work (Private), Meeting, AVChatRoom, and Community. |
GroupId | String | Optional | To simplify group IDs and make them easier to remember and share, we allow apps to customize group IDs when creating groups through the RESTful API. |
Name | String | Required | Group name, whose maximum length is 30 bytes. This field is UTF-8-encoded, and one Chinese character occupies 3 bytes. |
Introduction | String | Optional | Group introduction, whose maximum length is 240 bytes. This field is UTF-8-encoded, and one Chinese character occupies 3 bytes. |
Notification | String | Optional | Group notice, whose maximum length is 300 bytes. This field is UTF-8-encoded, and one Chinese character occupies 3 bytes. |
FaceUrl | String | Optional | URL of the group profile photo, whose maximum length is 100 bytes. |
MaxMemberCount | Integer | Optional | Maximum number of group members. The default value is the upper limit of the paid package. For example, it is 20 for a Developer edition. If you upgrade your package, you need to modify this field according to the basic information of the modified group. |
ApplyJoinOption | String | Optional | Method for handling requests to join the group, which can be FreeAccess , NeedPermission , or DisableApply . The default method is NeedPermission .This field is valid only for groups that can be joined by users. Community groups currently do not support this field. |
AppDefinedData | Array | Optional | Group-level custom field. This field is unavailable by default and needs to be enabled in the Chat console. For details, see Custom Fields. |
MemberList | Array | Optional | Initial group member list, which contains a maximum of 100 members. For details on group member information fields, see Group member profile. |
AppMemberDefinedData | Array | Optional | Group member custom fields. This field is unavailable by default and needs to be enabled in the Chat console. For details, see Custom Fields. |
SupportTopic | Integer | No | Whether the topic option is supported. This field is valid only for communities. |
{"ActionStatus": "OK","ErrorInfo": "","ErrorCode": 0,"GroupId": "@TGS#2J4SZEAEL"}
{"ActionStatus": "OK","ErrorInfo": "","ErrorCode": 0,"GroupId": "@TGS#_@TGS#cRDH3HIM62CP","HugeGroupFlag": 0,"Type": "Community"}
{"ActionStatus": "OK","ErrorInfo": "","ErrorCode": 0,"GroupId": "MyFirstGroup"}
Field | Type | Description |
ActionStatus | String | Request result. OK : Successful; FAIL : Failed |
ErrorCode | Integer | Error code. 0 : Successful; other values: Failed |
ErrorInfo | String | Error information |
GroupId | String | Group ID after successful creation, which is assigned by the Chat backend. |
ErrorCode
and ErrorInfo
respectively.
For public error codes (60000 to 79999), see Error Codes.
The following table describes the error codes specific to this API:Error Code | Description |
10002 | Internal server error. Try again. |
10003 | Invalid request command word. |
10004 | Invalid parameter. Check the error description and fix the issue. |
10005 | The number of members imported in the request packet exceeds 100. Reduce the number of members imported in the MemberList parameter. |
10006 | The operation exceeds the frequency limit. Please reduce the call frequency. This error is usually caused by too much net group increase in a single day or too frequent calls to obtain all groups in the app. |
10007 | Insufficient operation permission. Check the request parameters based on the error information. For example, the specified group type does not allow adding members but MemberList was specified in the request. |
10008 | The request is invalid, probably because verification of the signing information in the request failed. Please try again or submit a ticket. |
10016 | The app backend rejected this operation through a webhook. Check the returned value of your wehook "Before a group is created". |
10021 | The group ID has already been used by another user. Select another group ID. |
10025 | You have already used this group ID. Disband the existing group first or select another group ID. |
10036 | The number of audio-video groups (AVChatRoom) created exceeds the limit. Delete some of the groups or purchase an upgrade by referring to Pricing. |
10037 | The request specifies Owner_Account, but the number of groups that the group owner has created or joined exceeds the limit. The group owner needs to leave some groups first or refer to Pricing to purchase an upgrade. |
10038 | The number of members imported in the request packet exceeds the limit. Reduce the number of members imported in the MemberList parameter or purchase an upgrade by referring to Pricing. |
10058 | You are now using the Developer edition, and the free quota of 100 groups is exceeded. To create more groups, you need to purchase a package. |
この記事はお役に立ちましたか?