Skip to main content

Manage group members

Group member management involves operations such as member creation and deletion. Chat provides multiple APIs for adding and retrieving group members, adding a group administrator, and transferring the group owner.

This page shows how to manage group members by calling the Chat RESTful APIs. Before calling the following methods, ensure that you understand the call frequency limit described in Limitations.

Common parameters​

The following table lists common request and response parameters of the Chat RESTful APIs:

Request parameters ​

ParameterTypeDescriptionRequired
hostStringThe domain name assigned by the Chat service to access RESTful APIs. For how to get the domain name, see Get the information of your project.Yes
org_nameStringThe unique identifier assigned to each company (organization) by the Chat service. For how to get the org name, see Get the information of your project.Yes
app_nameStringThe unique identifier assigned to each app by the Chat service. For how to get the app name, see Get the information of your project.Yes
usernameStringThe unique login account of the user. The user ID must be 64 characters or less and cannot be empty. The following character sets are supported:
  • 26 lowercase English letters (a-z)
  • 10 numbers (0-9)
  • "_", "-", "."
info
  • Do not use any of the 26 uppercase English letters (A-Z).
  • Ensure that each username under the same app is unique.
Yes

Response parameters ​

ParameterTypeDescription
actionStringThe request method.
organizationStringThe unique identifier assigned to each company (organization) by the Chat service. This is the same as org_name.
applicationStringA unique internal ID assigned to each app by the Chat service. You can safely ignore this parameter.
applicationNameStringThe unique identifier assigned to each app by the Chat service. This is the same as app_name.
uriStringThe request URI.
pathStringThe request path, which is part of the request URI. You can safely ignore this parameter.
entities JSONThe response entity.
dataJSONThe details of the response.
timestampNumberThe Unix timestamp (ms) of the HTTP response.
durationNumberThe duration (ms) from when the HTTP request is sent to the time the response is received.

Authorization​

Chat RESTful APIs require Bearer HTTP authentication. Every time an HTTP request is sent, the following Authorization field must be filled in the request header:


_1
Authorization: Bearer ${YourAppToken}

In order to improve the security of the project, Agora uses a token (dynamic key) to authenticate users before they log in to the chat system. Chat RESTful APIs only support authenticating users using app tokens. For details, see Authentication using App Token.

Retrieving group members​

Retrieves the member list of the specified chat group with pagination.

HTTP request​


_4
GET https://{host}/{org_name}/{app_name}/chatgroups/{group_id}/users
_4
_4
// Gets the member list of the group with pagination.
_4
GET https://{host}/{org_name}/{app_name}/chatgroups/{group_id}/users?pagenum={N}&pagesize={N}

Path parameter​

ParameterTypeDescriptionRequired
group_idStringThe group ID.Yes

Query parameter​

ParameterTypeDescriptionRequired
pagenumNumberThe current page number. The query starts from the first page by default.No
pagesizeNumberThe number of members to retrieve per page. The default value is 10. The value range is [1,100].No

For other parameters and detailed descriptions, see Common parameters.

Request header​

ParameterTypeDescriptionRequired
AcceptStringThe parameter type. Set it as application/json.Yes
AuthorizationStringThe authentication token of the user or administrator, in the format of Bearer ${token}, where Bearer is a fixed character, followed by an English space, and then the obtained token value.Yes

HTTP response​

Response body​

If the returned HTTP status code is 200, the request succeeds, and the data field in the response body contains the following parameters.

ParameterTypeDescription
ownerStringThe username of the group owner, for example, {"owner":"user1"}.
memberStringThe username of a group admin or regular group member, for example, {"member":"user2"}.
countStringThe number of group members retrieved at this call of this API.

For other fields and descriptions, see Common parameters.

If the returned HTTP status code is not 200, the request fails. You can refer to Status codes for possible causes.

Example​

Request example​


_1
curl -X GET -H 'Accept: application/json' 'http://XXXX/XXXX/XXXX/chatgroups/10130212061185/users?pagenum=2&pagesize=2' -H 'Authorization: Bearer <YourAppToken>'

Response example​


_27
{
_27
"action": "get",
_27
"application": "527cd7e0-XXXX-XXXX-9f59-ef10ecd81ff0",
_27
"params": {
_27
"pagesize": [
_27
"2"
_27
],
_27
"pagenum": [
_27
"2"
_27
]
_27
},
_27
"uri": "http://XXXX/XXXX/XXXX/chatgroups/10130212061185/users",
_27
"entities": [],
_27
"data": [
_27
{
_27
"owner": "user1"
_27
},
_27
{
_27
"member": "user2"
_27
}
_27
],
_27
"timestamp": 1489074511416,
_27
"duration": 0,
_27
"organization": "XXXX",
_27
"applicationName": "XXXX",
_27
"count": 2
_27
}

Adding a user to the chat group​

Adds the specified user to the chat group. If the user is already a member of the chat group, an error is returned.

HTTP request​


_1
POST https://{host}/{org_name}/{app_name}/chatgroups/{group_id}/users/{username}

Path parameter​

ParameterTypeDescriptionRequired
group_idStringThe group ID.Yes

For other parameters and detailed descriptions, see Common parameters.

Request parameters​

ParameterTypeDescriptionRequired
Content-TypeStringThe parameter type. Set it as application/json.Yes
AcceptStringThe parameter type. Set it as application/json.Yes
AuthorizationStringThe authentication token of the user or administrator, in the format of Bearer ${token}, where Bearer is a fixed character, followed by an English space, and then the obtained token value.Yes

HTTP response​

Response body​

If the returned HTTP status code is 200, the request succeeds, and the data field in the response body contains the following parameters.

ParameterTypeDescription
resultBooleanWhether the user is successfully added to the chat group.
  • true: Yes.
  • false: No.
  • groupidStringThe group ID.
    actionStringThe request method.
    userStringThe username added to the chat group.

    For other fields and descriptions, see Common parameters.

    If the returned HTTP status code is not 200, the request fails. You can refer to Status codes for possible causes.

    Example​

    Request example​


    _1
    curl -X POST -H 'Content-Type: application/json' -H 'Accept: application/json' -H 'Authorization: Bearer <YourAppToken>' 'http://XXXX/XXXX/XXXX/chatgroups/66016455491585/users/user4'

    Response example​


    _16
    {
    _16
    "action": "post",
    _16
    "application": "8be024f0-XXXX-XXXX-b697-5d598d5f8402",
    _16
    "uri": "http://XXXX/XXXX/XXXX/chatgroups/66016455491585/users/user4",
    _16
    "entities": [],
    _16
    "data": {
    _16
    "result": true,
    _16
    "groupid": "66016455491585",
    _16
    "action": "add_member",
    _16
    "user": "user4"
    _16
    },
    _16
    "timestamp": 1542364958405,
    _16
    "duration": 0,
    _16
    "organization": "XXXX",
    _16
    "applicationName": "XXXX"
    _16
    }

    Adding multiple users to the chat group​

    Adds multiple users to the specified chat group. You can add a maximum of 60 users into a chat group each time. If the users are already members of the chat group, an error is returned in the response body.

    HTTP request​


    _1
    POST https://{host}/{org_name}/{app_name}/chatgroups/{chatgroupid}/users

    Path parameter​

    ParameterTypeDescriptionRequired
    group_idStringThe group ID.Yes

    For other parameters and detailed descriptions, see Common parameters.

    Request header​

    ParameterTypeDescriptionRequired
    Content-TypeStringThe parameter type. Set it as application/json.Yes
    AcceptStringThe parameter type. Set it as application/json.Yes
    AuthorizationStringThe authentication token of the user or administrator, in the format of Bearer ${token}, where Bearer is a fixed character, followed by an English space, and then the obtained token value.Yes

    Request body​

    ParameterTypeDescriptionRequired
    usernamesArrayThe usernames to add to the chat group. You can pass in a maximum of 60 usernames each time.Yes

    HTTP response​

    Response body​

    If the returned HTTP status code is 200, the request succeeds, and the data field in the response body contains the following parameters.

    ParameterTypeDescription
    newmembersArrayThe array of usernames that are added to the group.
    groupidStringThe group ID.
    actionStringThe request method.

    For other fields and descriptions, see Common parameters.

    If the returned HTTP status code is not 200, the request fails. You can refer to Status codes for possible causes.

    Example​

    Request example​


    _5
    curl -X POST -H 'Content-Type: application/json' -H 'Accept: application/json' -H 'Authorization: Bearer <YourAppToken>' -d '{
    _5
    "usernames": [
    _5
    "user4","user5"
    _5
    ]
    _5
    }' 'http://XXXX/XXXX/XXXX/chatgroups/66016455491585/users'

    Response example​


    _18
    {
    _18
    "action": "post",
    _18
    "application": "8be024f0-XXXX-XXXX-b697-5d598d5f8402",
    _18
    "uri": "http://XXXX/XXXX/XXXX/chatgroups/66016455491585/users",
    _18
    "entities": [],
    _18
    "data": {
    _18
    "newmembers": [
    _18
    "user5",
    _18
    "user4"
    _18
    ],
    _18
    "groupid": "66016455491585",
    _18
    "action": "add_member"
    _18
    },
    _18
    "timestamp": 1542365557942,
    _18
    "duration": 0,
    _18
    "organization": "XXXX",
    _18
    "applicationName": "XXXX"
    _18
    }

    Removing a chat group member​

    Removes the specified user from the chat group. If the specified user is not in the chat group, an error is returned.

    Once a member is removed from a chat group, they are also removed from all the threads they have joined in this chat group.

    HTTP request​


    _1
    DELETE https://{host}/{org_name}/{app_name}/chatgroups/{group_id}/users/{username}

    Path parameter​

    ParameterTypeDescriptionRequired
    group_idStringThe group ID.Yes

    For other parameters and detailed descriptions, see Common parameters.

    Request header​

    ParameterTypeDescriptionRequired
    AcceptStringThe parameter type. Set it as application/json.Yes
    AuthorizationStringThe authentication token of the user or administrator, in the format of Bearer ${token}, where Bearer is a fixed character, followed by an English space, and then the obtained token value.Yes

    HTTP response​

    Response body​

    If the returned HTTP status code is 200, the request succeeds, and the data field in the response body contains the following parameters.

    ParameterTypeDescription
    resultBooleanWhether the user is successfully removed from the chat group.
  • true: Yes.
  • false: No.
  • groupidStringThe group ID.
    actionStringThe request method.
    userStringThe usernames removed from the chat group.

    For other fields and descriptions, see Common parameters.

    If the returned HTTP status code is not 200, the request fails. You can refer to Status codes for possible causes.

    Example​

    Request example​


    _1
    curl -X DELETE -H 'Accept: application/json' -H 'Authorization: Bearer <YourAppToken>' 'http://XXXX/XXXX/XXXX/chatgroups/66016455491585/users/user3'

    Response example​


    _16
    {
    _16
    "action": "delete",
    _16
    "application": "8be024f0-XXXX-XXXX-b697-5d598d5f8402",
    _16
    "uri": "http://XXXX/XXXX/XXXX/chatgroups/66016455491585/users/user3",
    _16
    "entities": [],
    _16
    "data": {
    _16
    "result": true,
    _16
    "action": "remove_member",
    _16
    "user": "user3",
    _16
    "groupid": "66016455491585"
    _16
    },
    _16
    "timestamp": 1542365943067,
    _16
    "duration": 0,
    _16
    "organization": "XXXX",
    _16
    "applicationName": "XXXX"
    _16
    }

    Removing multiple group members​

    Removes multiple users from the chat group. You can remove a maximum of 60 members from the chat group each time. If the specified users are not in the group, an error is returned.

    Once a member is removed from a chat group, they are also removed from all the threads they have joined in this chat group.

    HTTP request​


    _1
    DELETE https://{host}/{org_name}/{app_name}/chatgroups/{group_id}/users/{members}

    Path parameter​

    ParameterTypeDescriptionRequired
    group_idStringThe group ID.Yes
    membersStringThe usernames of group members separated by the comma (,). For example, user1, user2.Yes

    For the descriptions of other path parameters, see Common Parameters.

    Request header​

    ParameterTypeDescriptionRequired
    AcceptStringThe parameter type. Set it as application/json.Yes
    AuthorizationStringThe authentication token of the user or administrator, in the format of Bearer ${token}, where Bearer is a fixed character, followed by an English space, and then the obtained token value.Yes

    HTTP response​

    Response body​

    If the returned HTTP status code is 200, the request succeeds to and the data field in the response body contains the following parameters.

    ParameterTypeDescription
    resultBooleanWhether the user is successfully removed from the chat group.
  • true: Yes.
  • false: No.
  • groupidStringThe group ID.
    reasonStringThe reason why the users fail to be removed from the chat group.
    actionStringThe request method.
    userStringThe usernames removed from the chat group.

    For other fields and descriptions, see Common parameters.

    If the returned HTTP status code is not 200, the request fails. You can refer to Status codes for possible causes.

    Example​

    Request example​


    _1
    curl -X DELETE -H 'Accept: application/json' -H 'Authorization: Bearer <YourAppToken>' 'http://XXXX/XXXX/XXXX/chatgroups/66016455491585/users/ttestuser0015981,user2,user3'

    Response example​


    _29
    {
    _29
    "action": "delete",
    _29
    "application": "9b848cf0-XXXX-XXXX-b5b8-0f74e8e740f7",
    _29
    "uri": "https://XXXX/XXXX/XXXX",
    _29
    "entities": [],
    _29
    "data": [{
    _29
    "result": false,
    _29
    "action": "remove_member",
    _29
    "reason": "user ttestuser0015981 doesn't exist.",
    _29
    "user": "user1",
    _29
    "groupid": "1433492852257879"
    _29
    },
    _29
    {
    _29
    "result": true,
    _29
    "action": "remove_member",
    _29
    "user": "user2",
    _29
    "groupid": "1433492852257879"
    _29
    },
    _29
    {
    _29
    "result": true,
    _29
    "action": "remove_member",
    _29
    "user": "user3",
    _29
    "groupid": "1433492852257879"
    _29
    }],
    _29
    "timestamp": 1433492935318,
    _29
    "duration": 84,
    _29
    "organization": "XXXX",
    _29
    "applicationName": "XXXX"
    _29
    }

    Setting custom attributes of a group member​

    Sets the custom attributes of a group member, such as adding a nickname or avatar. Each custom attribute should be in key-value format.

    HTTP request​


    _1
    PUT https://{host}/{org_name}/{app_name}/metadata/chatgroup/{group_id}/user/{username}

    Path parameter​

    ParameterTypeDescriptionRequired
    usernameStringThe user ID of a group member for which custom attributes are set.Yes

    For other parameters and detailed descriptions, see Common parameters.

    Request header​

    ParameterTypeDescriptionRequired
    Content-TypeStringThe parameter type. Set it as application/json.Yes
    AcceptStringThe parameter type. Set it as application/json.Yes
    AuthorizationStringThe authentication token of the user or administrator, in the format of Bearer ${YourAppToken}, where Bearer is a fixed character, followed by a space and then the obtained token value.Yes

    Response body​

    ParameterTypeDescription
    metaDataJSONCustom attributes of a group member to set. Each attribute is represented as a key-value pair:
    • The key indicates the attribute name and cannot exceed 16 bytes.
    • The value indicates the attribute value and cannot exceed 512 bytes. Passing an empty string to the value means to delete the attribute.
    For a single group member, the total length of custom attributes cannot exceed 4 KB.

    HTTP response​

    Response body​

    If the returned HTTP status code is 200, the request succeeds and the response body contains the following parameters.

    FieldTypeDescription
    dataJSONCustom attributes of a group member that are set.

    For other fields and descriptions, see Common parameters.

    If the returned HTTP status code is not 200, the request fails. You can refer to Status codes for possible causes.

    Example​

    Request example​


    _9
    curl --location --request PUT 'https://XXXX/XXXX/XXXX/metadata/chatgroup/207059303858177/user/test2' \
    _9
    -H 'Content-Type: application/json' \
    _9
    -H 'Accept: application/json'
    _9
    -H 'Authorization: Bearer <YourAppToken>' \
    _9
    -d '{
    _9
    "metaData": {
    _9
    "key1": "value1"
    _9
    }
    _9
    }'

    Response example​


    _7
    {
    _7
    "timestamp": 1678674135533,
    _7
    "data": {
    _7
    "key1": "value1"
    _7
    },
    _7
    "duration": 53
    _7
    }

    Retrieving all custom attributes of a group member​

    Retrieves all custom attributes of a group member.

    HTTP request​


    _1
    GET https://{host}/{org_name}/{app_name}/metadata/chatgroup/{group_id}/user/{username}

    Path parameter​

    ParameterTypeDescriptionRequired
    usernameStringThe user ID of a group member whose custom attributes are to be retrieved.Yes

    For other parameters and detailed descriptions, see Common parameters.

    Request header​

    ParameterTypeDescriptionRequired
    Content-TypeStringThe parameter type. Set it as application/json.Yes
    AcceptStringThe parameter type. Set it as application/json.Yes
    AuthorizationStringThe authentication token of the user or administrator, in the format of Bearer ${YourAppToken}, where Bearer is a fixed character, followed by an English space, and then the obtained token value.Yes

    HTTP response​

    Response body​

    If the returned HTTP status code is 200, the request succeeds and the response body will contain the following parameters.

    FieldTypeDescription
    dataJSONAll custom attributes of a group member that are retrieved.

    For other fields and descriptions, see Common parameters.

    If the returned HTTP status code is not 200, the request fails. You can refer to Status codes for possible causes.

    Example​

    Request example​


    _5
    curl --location --request GET 'https://XXXX/XXXX/XXXX/metadata/chatgroup/207059303858177/user/test2' \
    _5
    -H 'Content-Type: application/json' \
    _5
    -H 'Accept: application/json'
    _5
    -H 'Authorization: Bearer <YourAppToken>' \
    _5
    -d ''

    Response example​


    _7
    {
    _7
    "timestamp": 1678674211840,
    _7
    "data": {
    _7
    "key1": "value1"
    _7
    },
    _7
    "duration": 6
    _7
    }

    Retrieving custom attributes of multiple group members by attribute key​

    Retrieves custom attributes of multiple group members by attribute key. You can retrieve custom attributes of at most 10 group members each time.

    HTTP request​


    _1
    POST https://{host}/{org_name}/{app_name}/metadata/chatgroup/{group_id}/get

    Path parameter​

    For the parameters and detailed descriptions, see Common parameters.

    Request header​

    ParameterTypeDescriptionRequired
    Content-TypeStringThe parameter type. Set it as application/json.Yes
    AcceptStringThe parameter type. Set it as application/json.Yes
    AuthorizationStringThe authentication token of the user or administrator, in the format of Bearer ${YourAppToken}, where Bearer is a fixed character, followed by an English space, and then the obtained token value.Yes

    Request body​

    ParameterTypeDescriptionRequired
    targetsJSON ArrayThe user IDs of group members whose custom attributes are to be retrieved. You can pass in at most 10 user IDs.Yes
    propertiesJSON ArrayThe array of keys of custom attributes to retrieve. If you pass in an empty string or no value to the parameter, all custom attributes of the group members will be returned.Yes

    HTTP response​

    Response body​

    If the returned HTTP status code is 200, the request succeeds and the response body will contain the following parameters.

    FieldTypeDescription
    dataJSONThe custom attributes of the group members that are retrieved. As shown in the following response example, test1 and test2 are user IDs of group members to which the retrieved custom attributes belong.

    For other fields and descriptions, see Common parameters.

    If the returned HTTP status code is not 200, the request fails. You can refer to Status codes for possible causes.

    Example​

    Request example​


    _8
    curl --location --request POST 'https://XXXX/XXXX/XXXX/metadata/chatgroup/207059303858177/get' \
    _8
    -H 'Content-Type: application/json' \
    _8
    -H 'Accept: application/json'
    _8
    -H 'Authorization: Bearer <YourAppToken>' \
    _8
    -d '{
    _8
    "targets":["test1","test2"],
    _8
    "properties":["key1","key2"]
    _8
    }'

    Response example​


    _12
    {
    _12
    "timestamp": 1678674292783,
    _12
    "data": {
    _12
    "test1": {
    _12
    "key1": "value1"
    _12
    },
    _12
    "test2": {
    _12
    "key1": "value1"
    _12
    }
    _12
    },
    _12
    "duration": 2
    _12
    }

    Retrieving group admin list​

    Retrieves the list of the chat group admins.

    HTTP request​


    _1
    GET https://{host}/{org_name}/{app_name}/chatgroups/{group_id}/admin

    Path parameter​

    ParameterTypeDescriptionRequired
    group_idStringThe group ID.Yes

    For other parameters and detailed descriptions, see Common parameters.

    Request header​

    ParameterTypeDescriptionRequired
    Content-TypeStringThe parameter type. Set it as application/json.Yes
    AuthorizationStringThe authentication token of the user or administrator, in the format of Bearer ${token}, where Bearer is a fixed character, followed by an English space, and then the obtained token value.Yes

    HTTP response​

    Response body​

    If the returned HTTP status code is 200, the request succeeds, and the data field in the response body contain the information of the chat group admins. For other fields and descriptions, see Common parameters.

    If the returned HTTP status code is not 200, the request fails. You can refer to Status codes for possible causes.

    Example​

    Request example​


    _1
    curl -X GET HTTP://XXXX/XXXX/XXXX/chatgroups/10130212061185/admin -H 'Authorization: Bearer <YourAppToken>'

    Response example​


    _12
    {
    _12
    "action": "get",
    _12
    "application": "527cd7e0-XXXX-XXXX-9f59-ef10ecd81ff0",
    _12
    "uri": "http://XXXX/XXXX/XXXX/chatgroups/10130212061185/admin",
    _12
    "entities": [],
    _12
    "data": ["user1"],
    _12
    "timestamp": 1489073361210,
    _12
    "duration": 0,
    _12
    "organization": "XXXX",
    _12
    "applicationName": "XXXX",
    _12
    "count": 1
    _12
    }

    Adding a group admin​

    Adds a regular group member to the group admin list. A chat group admin has the privilege to manage the chat group blocklist and mute chat group members. You can add a maximum of 99 chat group admins.

    HTTP request​


    _1
    POST https://{host}/{org_name}/{app_name}/chatgroups/{group_id}/admin

    Path parameter​

    ParameterTypeDescriptionRequired
    group_idStringThe group ID.Yes

    For other parameters and detailed descriptions, see Common parameters.

    Request header​

    ParameterTypeDescriptionRequired
    Content-TypeStringThe parameter type. Set it as application/json.Yes
    AcceptStringThe parameter type. Set it as application/json.Yes
    AuthorizationStringThe authentication token of the user or administrator, in the format of Bearer ${token}, where Bearer is a fixed character, followed by an English space, and then the obtained token value.Yes

    Request body​

    ParameterTypeDescriptionRequired
    newadminStringThe username of the chat group admin.Yes

    HTTP response​

    Response body​

    If the returned HTTP status code is 200, the request succeeds, and the data field in the response body contains the following parameters.

    ParameterTypeDescription
    dataStringThe user IDs promoted to group admins.
    countNumberThe number of users to be promoted as group admins.

    For other fields and descriptions, see Common parameters.

    If the returned HTTP status code is not 200, the request fails. You can refer to Status codes for possible causes.

    Example​

    Request example​


    _1
    curl -X POST -H 'Content-type: application/json' -H 'Accept: application/json' 'http://XXXX/XXXX/XXXX/chatgroups/10130212061185/admin' -d '{"newadmin":"user1"}' -H 'Authorization: Bearer <YourAppToken>'

    Response example​


    _15
    {
    _15
    "action": "post",
    _15
    "application": "52XXXXf0",
    _15
    "applicationName": "demo",
    _15
    "data": {
    _15
    "result": "success",
    _15
    "newadmin": "man"
    _15
    },
    _15
    "duration": 0,
    _15
    "entities": [],
    _15
    "organization": "XXXX",
    _15
    "properties": {},
    _15
    "timestamp": 1680074570600,
    _15
    "uri": "http://XXXX/XXXX/XXXX/chatgroups/190141728620545/admin"
    _15
    }

    Removing a group admin​

    Removes the specified user from the chat group admin list.

    HTTP request​


    _1
    DELETE https://{host}/{org_name}/{app_name}/chatgroups/{group_id}/admin/{username}

    Path parameter​

    ParameterTypeDescriptionRequired
    group_idStringThe group ID.Yes

    For other parameters and detailed descriptions, see Common parameters.

    Request header​

    ParameterTypeDescriptionRequired
    AcceptStringThe parameter type. Set it as application/json.Yes
    AuthorizationStringThe authentication token of the user or administrator, in the format of Bearer ${token}, where Bearer is a fixed character, followed by an English space, and then the obtained token value.Yes

    HTTP response​

    Response body​

    If the returned HTTP status code is 200, the request succeeds, and the data field in the response body contains the following parameters.

    ParameterTypeDescription
    resultBooleanWhether the group admin is successfully demoted to a regular group member:
    • true: Yes.
    • false: No.
    oldadminStringThe ID of the group admin demoted to a regular group member.

    For other fields and descriptions, see Common parameters.

    If the returned HTTP status code is not 200, the request fails. You can refer to Status codes for possible causes.

    Example​

    Request example​


    _1
    curl -X DELETE -H 'Accept: application/json' 'http://XXXX/XXXX/XXXX/chatgroups/10130212061185/admin/user1' -H 'Authorization: Bearer <YourAppToken>'

    Response example​


    _14
    {
    _14
    "action": "delete",
    _14
    "application": "527cd7e0-XXXX-XXXX-9f59-ef10ecd81ff0",
    _14
    "uri": "http://XXXX/XXXX/XXXX/chatgroups/10130212061185/admin/user1",
    _14
    "entities": [],
    _14
    "data": {
    _14
    "result": "success",
    _14
    "oldadmin": "user1"
    _14
    },
    _14
    "timestamp": 1489073432732,
    _14
    "duration": 1,
    _14
    "organization": "XXXX",
    _14
    "applicationName": "XXXX"
    _14
    }

    Transferring group ownership​

    Changes the group owner to another group member. Group owners possess all group privileges.

    HTTP request​


    _1
    PUT https://{host}/{org_name}/{app_name}/chatgroups/{group_id}

    Path parameter​

    ParameterTypeDescriptionRequired
    group_idStringThe group ID.Yes

    For other parameters and detailed descriptions, see Common parameters.

    Request header​

    ParameterTypeDescriptionRequired
    Content-TypeStringThe parameter type. Set it as application/json.Yes
    AcceptStringThe parameter type. Set it as application/json.Yes
    AuthorizationStringThe authentication token of the user or administrator, in the format of Bearer ${token}, where Bearer is a fixed character, followed by an English space, and then the obtained token value.Yes

    Request body​

    ParameterTypeDescriptionRequired
    newownerStringThe username of the new group owner.Yes

    HTTP response​

    Response body​

    If the returned HTTP status code is 200, the request succeeds and the data field in the response body will contain the following parameters.

    ParameterTypeDescription
    newownerBooleanWhether the user is successfully set as the chat group owner. true: Yes; false: No.

    For other fields and descriptions, see Common parameters.

    If the returned HTTP status code is not 200, the request fails. You can refer to Status codes for possible causes.

    Example​

    Request example​


    _1
    curl -X PUT -H 'Content-Type: application/json' -H 'Accept: application/json' -H 'Authorization: Bearer <YourAppToken>' -d '{ "newowner": "user2" }' 'http://XXXX/XXXX/XXXX/chatgroups/66016455491585'

    Response example​


    _13
    {
    _13
    "action": "put",
    _13
    "application": "8be024f0-XXXX-XXXX-b697-5d598d5f8402",
    _13
    "uri": "http://XXXX/XXXX/XXXX/chatgroups/66016455491585",
    _13
    "entities": [],
    _13
    "data": {
    _13
    "newowner": true
    _13
    },
    _13
    "timestamp": 1542537813420,
    _13
    "duration": 0,
    _13
    "organization": "XXXX",
    _13
    "applicationName": "XXXX"
    _13
    }

    Status codes​

    For details, see HTTP Status Codes.