Update room attributes
Description
Update the custom room attributes of the specified room ID. A room can set up to 20 room attributes. If you need to increase the upper limit of the number of room attributes, please contact ZEGOCLOUD Technical Support.
Request method and endpoint
- Request method: POST
- Request URL:
https://zim-api.zego.im/?Action=ModifyRoomAttribute
- Transmission protocol: HTTPS
- QPS limit: 20 requests/second
Request parameters
The following table describes only the operation-specific request parameters and some common request parameters. For the complete list of common request parameters, see the Common request parameters section of the Accessing Server APIs topic.
Parameter | Type | Required | Description |
---|---|---|---|
FromUserId | String | Yes | The operator, which needs to be in the registered state. This user will not be automatically added to the room. Only numbers, English characters, '!', '#', '$', '%', '&', '(', ')', '+', '-', ':', ';', '<', '=', '.', '>', '?', '@', '[', ']', '^', '_', ' ', ', ', '|', '~' are supported. |
RoomId | String | Yes | Room ID. Only numbers, English characters, '!', '#', '$', '%', '&', '(', ')', '+', '-', ':', ';', '<', '=', '.', '>', '?', '@', '[', ']', '^', '_', ' ', ', ', '|', '~' are supported. |
Attributes | Array of ModifyRoomAttribute | Yes | The room attribute information to be updated. |
ModifyRoomAttribute structure:
Parameter | Type | Required | Description |
---|---|---|---|
Action | Number | Yes | Delete or set, 0: set, 1: delete. |
Key | String | Yes | Room attribute key. |
Value | String | No | Room attribute value. |
AutoDelete | Number | No | Whether to automatically delete when the user exits the room, 0: not automatically delete, 1: automatically delete. If FromUserId is not in the room, it will trigger the deletion operation after it enters the room and then exits the room. |
If the Key already exists, the existing attribute information will be modified.
Request example
- Request URL:
https://zim-api.zego.im/?Action=ModifyRoomAttribute
&<Common request parameters>
- Request body:
{
"RoomId": "room123",
"FromUserId": "fromUserId",
"Attributes": [
{
"Action": 0,
"Key": "attribute1",
"Value": "value1",
"AutoDelete": 1
},
{
"Action": 1,
"Key": "attribute2",
"Value": "",
"AutoDelete": 0
}
]
}
Response parameters
The response parameters are as follows:
Parameter | Type | Required | Description |
---|---|---|---|
Code | Number | Yes | Return status code (0 means success). |
Message | String | Yes | Return status information. |
RequestId | string | Yes | Request unique identifier. |
ErrKeyList | Array of ErrList | No | The list of keys that |
ErrList structure:
Parameter | Type | Required | Description |
---|---|---|---|
SubCode | Number | Yes | Error code. |
Key | String | Yes | The key value that caused the error. |
Response example
{
"Code": 0,
"Message": "success",
"RequestId": "req-123456789",
"ErrKeyList": [
{
"SubCode": 1,
"Key": "attr1"
},
{
"SubCode": 2,
"Key": "attr2"
}
]
}
Return codes
The following return codes are only listed for interface business logic. For the complete list of return codes, see Global return codes.
Return code | Description | Solution |
---|---|---|
660000002 | Parameter error. | Please check the parameters. |
660300005 | Frequency limit. | Please try again later. |