diff --git a/en-US/markdown/agora-chat/Develop/Chat Groups/agora_chat_group_android.md b/en-US/markdown/agora-chat/Develop/Chat Groups/agora_chat_group_android.md index 63666ca304a..769d4bcb9c7 100644 --- a/en-US/markdown/agora-chat/Develop/Chat Groups/agora_chat_group_android.md +++ b/en-US/markdown/agora-chat/Develop/Chat Groups/agora_chat_group_android.md @@ -84,6 +84,42 @@ ChatClient.getInstance().groupManager().joinGroup(groupId); ChatClient.getInstance().groupManager().leaveGroup(groupId); ``` +### Retrieve the chat group list + +Users can call `getJoinedGroupsFromServer` to retrieve from the server the list of chat groups that they created and joined. + +```java +// It is an asynchronous method. The synchronous method is getJoinedGroupsFromServer(int, int, boolean, boolean). +// pageIndex: The current page number, starting from 0. +// pageSize: The number of groups to retrieve per page. The value range is [1,20]. +List grouplist = ChatClient.getInstance().groupManager().asyncGetJoinedGroupsFromServer(pageIndex, pageSize, needMemberCount, needRole, new ValueCallBack>() { + @Override + public void onSuccess(List value) { + + } + + @Override + public void onError(int error, String errorMsg) { + + } + }); +``` + +- Users can call `getAllGroups` to load the list of created and joined chat groups from the local database. To ensure data accuracy, users need to first obtain from the server the list of chat groups that they created and joined. + +```java +List grouplist = ChatClient.getInstance().groupManager().getAllGroups(); +``` + +- Users can call `getPublicGroupsFromServer` to retrieve the list of public groups: + +```java +// It is a synchronous method and may block the current thread. The asynchronous method is asyncGetPublicGroupsFromServer(int, String, ValueCallBack). +CursorResult result = ChatClient.getInstance().groupManager().getPublicGroupsFromServer(pageSize, cursor); +List groupsList = result.getData(); +String cursor = result.getCursor(); +``` + ### Retrieve the member list of a chat group - When a group has less than 200 members, you can call the `getGroupFromServer` method to retrieve the group member list that contains the group owner, admins, and regular members. diff --git a/en-US/markdown/agora-chat/Develop/Chat Groups/agora_chat_group_flutter.md b/en-US/markdown/agora-chat/Develop/Chat Groups/agora_chat_group_flutter.md index d100c4b125c..c0050f4e559 100644 --- a/en-US/markdown/agora-chat/Develop/Chat Groups/agora_chat_group_flutter.md +++ b/en-US/markdown/agora-chat/Develop/Chat Groups/agora_chat_group_flutter.md @@ -176,7 +176,7 @@ try { ### Retrieve the chat group list -Users can call `fetchJoinedGroupsFromServer` to retrieve the joined chat group list from the server with pagination, as shown in the following code sample: +Users can call `fetchJoinedGroupsFromServer` to retrieve from the server the list of chat groups that they created and joined: ```dart try { @@ -186,7 +186,7 @@ try { } ``` -Users can call `getJoinedGroups` to retrieve the joined chat group list from the local database. To ensure the accuracy of results, retrieve the joined chat group list from the server first. The code sample is as follows: +Users can call `getJoinedGroups` to load the list of created and joined chat groups from the local database. To ensure data accuracy, users need to first obtain from the server the list of chat groups that they created and joined. ```dart try { diff --git a/en-US/markdown/agora-chat/Develop/Chat Groups/agora_chat_group_ios.md b/en-US/markdown/agora-chat/Develop/Chat Groups/agora_chat_group_ios.md index c83318b4d7d..fa68a3d1adf 100644 --- a/en-US/markdown/agora-chat/Develop/Chat Groups/agora_chat_group_ios.md +++ b/en-US/markdown/agora-chat/Develop/Chat Groups/agora_chat_group_ios.md @@ -142,6 +142,34 @@ do { } while (result && result.list < pageSize); ``` +### Retrieve the chat group list + +Users can call `getJoinedGroupsFromServer` to retrieve from the server the list of chat groups that they created and joined. + +```swift +// It is an asynchronous method. +AgoraChatClient.shared().groupManager?.getJoinedGroupsFromServer(withPage: 0, pageSize: 20, needMemberCount: true, needRole: true, completion: { groups, err in + // group list + }) +``` + +- Users can call `getJoinedGroups` to load the list of created and joined chat groups from the local database. To ensure data accuracy, users need to first obtain from the server the list of chat groups that they created and joined. + +```swift +// It is a synchronous method. +let groups = AgoraChatClient.shared().groupManager?.getJoinedGroups() +``` + +- Users can call `getPublicGroupsFromServerWithCursor` to retrieve the list of public groups: + +```swift +AgoraChatClient.shared().groupManager?.getPublicGroupsFromServer(withCursor: "", pageSize: 20, completion: { result, err in + if let groups = result?.list { + // got groups + } + }) +``` + ### Block and unblock a chat group All chat group members can block and unblock a chat group. Once members block a chat group, they no longer receive messages from this chat group. diff --git a/en-US/markdown/agora-chat/Develop/Chat Groups/agora_chat_group_rn.md b/en-US/markdown/agora-chat/Develop/Chat Groups/agora_chat_group_rn.md index 57377080be4..d8e30474315 100644 --- a/en-US/markdown/agora-chat/Develop/Chat Groups/agora_chat_group_rn.md +++ b/en-US/markdown/agora-chat/Develop/Chat Groups/agora_chat_group_rn.md @@ -209,12 +209,12 @@ ChatClient.getInstance() ### Retrieve the chat group list -Users can call `fetchJoinedGroupsFromServer` to retrieve the joined chat group list from the server with pagination, as shown in the following code sample: +Users can call `fetchJoinedGroupsFromServer` to retrieve from the server the list of chat groups that they created and joined: ```typescript -// The maximum number of chat groups to retrieve with pagination. +// The number of groups to retrieve per page. The value range is [1,20]. const pageSize = 10; -// The page number from which to start getting data. +// The current page number, starting from 0. const pageNum = 1; ChatClient.getInstance() .groupManager.fetchJoinedGroupsFromServer(pageSize, pageNum) @@ -226,7 +226,7 @@ ChatClient.getInstance() }); ``` -Users can call `getJoinedGroups` to retrieve the joined chat group list from the local database. To ensure the accuracy of results, retrieve the joined chat group list from the server first. The code sample is as follows: +Users can call `getJoinedGroups` to load the list of created and joined chat groups from the local database. To ensure data accuracy, users need to first obtain from the server the list of chat groups that they created and joined. ```typescript ChatClient.getInstance() diff --git a/en-US/markdown/agora-chat/Develop/Chat Groups/agora_chat_group_unity.md b/en-US/markdown/agora-chat/Develop/Chat Groups/agora_chat_group_unity.md index d67b87e6cdc..f4f6a1deb05 100644 --- a/en-US/markdown/agora-chat/Develop/Chat Groups/agora_chat_group_unity.md +++ b/en-US/markdown/agora-chat/Develop/Chat Groups/agora_chat_group_unity.md @@ -184,7 +184,7 @@ SDKClient.Instance.GroupManager.GetGroupMemberListFromServer(groupId, pageSize, ### Retrieve the chat group list -Users can call `FetchJoinedGroupsFromServer` to retrieve the joined chat group list from the server, as shown in the following code sample: +Users can call `FetchJoinedGroupsFromServer` to retrieve from the server the list of chat groups that they created and joined: ```c# SDKClient.Instance.GroupManager.FetchJoinedGroupsFromServer(callback: new ValueCallBack>( @@ -196,7 +196,7 @@ SDKClient.Instance.GroupManager.FetchJoinedGroupsFromServer(callback: new ValueC )); ``` -Users can call `GetJoinedGroups` to retrieve the joined chat group list from the local database. To ensure the accuracy of results, retrieve the joined chat group list from the server first. The code sample is as follows: +Users can call `GetJoinedGroups` to load the list of created and joined chat groups from the local database. To ensure data accuracy, users need to first obtain from the server the list of chat groups that they created and joined. ```c# List groupList = SDKClient.Instance.GroupManager.GetJoinedGroups(); diff --git a/en-US/markdown/agora-chat/Develop/Chat Groups/agora_chat_group_web.md b/en-US/markdown/agora-chat/Develop/Chat Groups/agora_chat_group_web.md index 8a3b4bb9af4..6094fda8f0f 100644 --- a/en-US/markdown/agora-chat/Develop/Chat Groups/agora_chat_group_web.md +++ b/en-US/markdown/agora-chat/Develop/Chat Groups/agora_chat_group_web.md @@ -112,6 +112,28 @@ let option = { conn.leaveGroup(option).then(res => console.log(res)) ``` +### Retrieve the chat group list + +Users can call `getJoinedGroups` to retrieve from the server the list of chat groups that they created and joined: + +```javascript +conn.getJoinedGroups({ + pageNum: 0, + pageSize: 20, + needAffiliations: true, + needRole: true, +}); +``` + +- Users can also call `getPublicGroups` to retrieve list of public chat groups from the server with pagination: + +```javascript +let option = { + limit: 20, + cursor: cursor, +}; +conn.getPublicGroups(option).then((res) => console.log(res)); +``` ### Retrieve the member list of a chat group diff --git a/en-US/markdown/agora-chat/Develop/Chat Groups/agora_chat_group_windows.md b/en-US/markdown/agora-chat/Develop/Chat Groups/agora_chat_group_windows.md index a30b1414e3e..d9bc448adee 100644 --- a/en-US/markdown/agora-chat/Develop/Chat Groups/agora_chat_group_windows.md +++ b/en-US/markdown/agora-chat/Develop/Chat Groups/agora_chat_group_windows.md @@ -184,7 +184,7 @@ SDKClient.Instance.GroupManager.GetGroupMemberListFromServer(groupId, pageSize, ### Retrieve the chat group list -Users can call `FetchJoinedGroupsFromServer` to retrieve the joined chat group list from the server, as shown in the following code sample: +Users can call `FetchJoinedGroupsFromServer` to retrieve from the server the list of chat groups that they created and joined: ```c# SDKClient.Instance.GroupManager.FetchJoinedGroupsFromServer(callback: new ValueCallBack>( @@ -196,7 +196,7 @@ SDKClient.Instance.GroupManager.FetchJoinedGroupsFromServer(callback: new ValueC )); ``` -Users can call `GetJoinedGroups` to retrieve the joined chat group list from the local database. To ensure the accuracy of results, retrieve the joined chat group list from the server first. The code sample is as follows: +Users can call `GetJoinedGroups` to load the list of created and joined chat groups from the local database. To ensure data accuracy, users need to first obtain from the server the list of chat groups that they created and joined. ```c# List groupList = SDKClient.Instance.GroupManager.GetJoinedGroups(); diff --git a/en-US/markdown/agora-chat/Develop/Messages/Manage Local Messages/agora_chat_manage_message_rn.md b/en-US/markdown/agora-chat/Develop/Messages/Manage Local Messages/agora_chat_manage_message_rn.md index 40f152ebf55..0407aa5afdd 100644 --- a/en-US/markdown/agora-chat/Develop/Messages/Manage Local Messages/agora_chat_manage_message_rn.md +++ b/en-US/markdown/agora-chat/Develop/Messages/Manage Local Messages/agora_chat_manage_message_rn.md @@ -63,6 +63,30 @@ ChatClient.getInstance() }); ``` +```typescript +// convId: Specify the conversation ID which is the peer user ID for one-to-one chat, group ID for group chat, and chat room ID for room chat. +// convType: Set conversation type which is PeerChat for one-to-one chat, GroupChat for group chat, and RoomChat for room chat。 +// cursor: The starting message ID for query. Pass in `null` or an empty string at the first call to query from the latest message. +// pageSize The number of messages to retrieve per page. The value range is [1,50], with 10 as the default. +// option: The message query options. +// option.from: The message sender. +// option.msgTypes The message types for query. +// option.startTs: The start time for query. +// option.endTs: The end time for query. +// option.direction: The message direction. +// option.needSave: Whether to save the messages. +ChatClient.getInstance() + .chatManager.fetchHistoryMessagesByOptions(convId, convType, { + cursor: cursor, + pageSize: pageSize, + options: options as ChatFetchMessageOptions, + }) + .then((res) => { + console.log("fetchHistoryMessagesByOptions is success.", res); + }) + .catch(); +``` + ### Retrieve the count of unread messages in the specified conversation Refer to the following code example to retrieve the count of unread messages: diff --git a/en-US/markdown/agora-chat/Develop/Presence/agora_chat_presence_flutter.md b/en-US/markdown/agora-chat/Develop/Presence/agora_chat_presence_flutter.md index b97122ec3c4..747a7e886cf 100644 --- a/en-US/markdown/agora-chat/Develop/Presence/agora_chat_presence_flutter.md +++ b/en-US/markdown/agora-chat/Develop/Presence/agora_chat_presence_flutter.md @@ -100,12 +100,12 @@ Refer to the following code sample to listen for presence status updates: ### Unsubscribe from the presence status of one or more users -You can call `unSubscribe` to unsubscribe from the presence statuses of the specified users, as shown in the following code sample: +You can call `unsubscribe` to unsubscribe from the presence statuses of the specified users, as shown in the following code sample: ```dart // memberIds: The ID list of users from whom you unsubscribe. try { - await ChatClient.getInstance.presenceManager.unSubscribe( + await ChatClient.getInstance.presenceManager.unsubscribe( members: members, ); } on ChatError catch (e) { diff --git a/en-US/markdown/agora-chat/RESTful API Reference/agora_chat_rest_registration.md b/en-US/markdown/agora-chat/RESTful API Reference/agora_chat_rest_registration.md index e4a8f13e040..e654aecb19e 100644 --- a/en-US/markdown/agora-chat/RESTful API Reference/agora_chat_rest_registration.md +++ b/en-US/markdown/agora-chat/RESTful API Reference/agora_chat_rest_registration.md @@ -69,6 +69,7 @@ For the parameters and detailed descriptions, see [Common parameters](#param). | Parameter | Type | Description | Required | | :-------------- | :----- | :--------------------- | :------- | | `Content-Type` | String | `application/json` | Yes | +| `Accept` | String | `application/json` | Yes | | `Authorization` | String | The authentication token of the user or admin, 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 @@ -320,7 +321,15 @@ If the returned HTTP status code is `200`, the request succeeds, and the respons | Field | Type | Description | | :------------------ | :----- | :--------------------------------------------------------------------------------------------------------- | -| `count` | Number | The number of users. | +| `entities` | JSON Array | The response entity. | +| - `notification_display_style` | Number | Message push method: - `0`: Notification only. The push title is "You have a new message" and the push content is "Please click to view"; - `1`: Notification and message details. The push title is "You have a new message" and the push content is the sender's nickname and the content of the offline message. This parameter, if not set, will not be returned in the response. | +| - `notification_no_disturbing` | Boolean | Whether to enable Do Not Disturb (DND). - `true`: DND is enabled. This parameter, if not set, will not be returned in the response. - `false`: DND is turned off. | +| - `notification_no_disturbing_start` | String | The start time of DND. For example, "8" means DND is turned on at 8:00 every day. This parameter, if not set, will not be returned in the response. | +| - `notification_no_disturbing_end` | String | The end time of DND. For example, "18" means DND is turned off at 18:00 every day. This parameter, if not set, will not be returned in the response. | +| - `notification_ignore_XXXX` | Boolean | Whether to block the setting of offline push of group messages. `xxxx` in the parameter, for example `63112447328257`, represents the group ID. -`true`: Blocked. - `false`: Not blocked. This parameter, if not set, will not be returned in the response. | +| - `notifier_name` | String | The name of the client push certificate. This parameter, if not set, will not be returned in the response. | +| - `device_token` | String | The device token. The device token, if not obtained, will not be returned in the response. | +| `count` | Number | The user count | For other fields and detailed descriptions, see [Common parameters](#param). @@ -397,6 +406,14 @@ If the returned HTTP status code is `200`, the request succeeds, and the respons | Parameter | Type | Description | | :------------------ | :----- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `entities` | JSON Array | The response entity. | +| - `notification_display_style` | Number | Message push method: - `0`: Notification only. The push title is "You have a new message" and the push content is "Please click to view"; - `1`: Notification and message details. The push title is "You have a new message" and the push content is the sender's nickname and the content of the offline message. This parameter, if not set, will not be returned in the response. | +| - `notification_no_disturbing` | Boolean | Whether to enable Do Not Disturb (DND). - `true`: DND is enabled. This parameter, if not set, will not be returned in the response. - `false`: DND is turned off. | +| - `notification_no_disturbing_start` | String | The start time of DND. For example, "8" means DND is turned on at 8:00 every day. This parameter, if not set, will not be returned in the response. | +| - `notification_no_disturbing_end` | String | The end time of DND. For example, "18" means DND is turned off at 18:00 every day. This parameter, if not set, will not be returned in the response. | +| - `notification_ignore_XXXX` | Boolean | Whether to block the setting of offline push of group messages. `xxxx` in the parameter, for example `63112447328257`, represents the group ID. -`true`: Blocked. - `false`: Not blocked. This parameter, if not set, will not be returned in the response. | +| - `notifier_name` | String | The name of the client push certificate. This parameter, if not set, will not be returned in the response. | +| - `device_token` | String | The device token. The device token, if not obtained, will not be returned in the response. | | `cursor` | String | The cursor used for paginating the user lists.
You do not need to set `cursor` at the first query. When the request succeeds, you can get the `cursor` from the response body, and pass this `cursor` in the URL of the next query, until there is no longer a `cursor` filed in the response body, which indicates that all the users in the app have been queried. | | `count` | Number | The number of users. | @@ -737,7 +754,6 @@ For the parameters and detailed descriptions, see [Common parameters](#param). | Parameter | Type | Description | Required | | :-------------- | :----- | :--------------------- | :------- | -| `Content-Type` | String | `application/json` | Yes | | `Accept` | String | `application/json` | Yes | | `Authorization` | String | The authentication token of the user or admin, in the format of `Bearer ${YourAppToken}`, where `Bearer` is a fixed character, followed by an English space, and then the obtained token value. | Yes | @@ -757,7 +773,7 @@ If the returned HTTP status code is not `200`, the request fails. You can refer ```shell # Replace {YourAppToken} with the app token generated in your server. -curl -X POST -H 'Content-Type: application/json' -H 'Accept: application/json' -H 'Authorization: Bearer {YourAppToken}' 'http://XXXX/XXXX/XXXX/users/user1/deactivate' +curl -X POST -H 'Accept: application/json' -H 'Authorization: Bearer {YourAppToken}' 'http://XXXX/XXXX/XXXX/users/user1/deactivate' ``` #### Response example @@ -802,7 +818,6 @@ For the parameters and detailed descriptions, see [Common parameters](#param). | Parameter | Type | Description | Required | | :-------------- | :----- | :--------------------- | :------- | -| `Content-Type` | String | `application/json` | Yes | | `Accept` | String | `application/json` | Yes | | `Authorization` | String | The authentication token of the user or admin, in the format of `Bearer ${YourAppToken}`, where `Bearer` is a fixed character, followed by an English space, and then the obtained token value. | Yes | @@ -821,7 +836,7 @@ If the returned HTTP status code is not `200`, the request fails. You can refer ```shell # Replace {YourAppToken} with the app token generated in your server. -curl -X POST -H 'Content-Type: application/json' -H 'Accept: application/json' -H 'Authorization: Bearer {YourAppToken}' 'http://XXXX/XXXX/XXXX/users/user1/activate' +curl -X POST -H 'Accept: application/json' -H 'Authorization: Bearer {YourAppToken}' 'http://XXXX/XXXX/XXXX/users/user1/activate' ``` #### Response example @@ -854,7 +869,6 @@ For the parameters and detailed descriptions, see [Common parameters](#param). | Parameter | Type | Description | Required | | :-------------- | :----- | :--------------------- | :------- | -| `Content-Type` | String | `application/json` | Yes | | `Accept` | String | `application/json` | Yes | | `Authorization` | String | The authentication token of the user or admin, in the format of `Bearer ${YourAppToken}`, where `Bearer` is a fixed character, followed by an English space, and then the obtained token value. | Yes | @@ -922,7 +936,7 @@ For the parameters and detailed descriptions, see [Common parameters](#param). | Parameter | Type | Description | Required | | :-------------- | :----- | :--------------------- | :------- | -| `Content-Type` | String | `application/json` | Yes | +| `Accept` | String | `application/json` | Yes | | `Authorization` | String | The authentication token of the user or admin, 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 @@ -985,6 +999,7 @@ For the parameters and detailed descriptions, see [Common parameters](#param). | Parameter | Type | Description | Required | | :-------------- | :----- | :--------------------- | :------- | | `Content-Type` | String | `application/json` | Yes | +| `Accept` | String | `application/json` | Yes | | `Authorization` | String | The authentication token of the user or admin, 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 @@ -1011,7 +1026,7 @@ If the returned HTTP status code is not `200`, the request fails. You can refer ```shell # Replace {YourAppToken} with the app token generated in your server. -curl -X POST http://XXXX/XXXX/XXXX/users/batch/status -H 'Authorization: Bearer {YourAppToken}' -H 'Content-Type: application/json' -d '{"usernames":["user1","user2"]}' +curl -X POST http://XXXX/XXXX/XXXX/users/batch/status -H 'Content-Type: application/json' -H 'Accept: application/json' -H 'Authorization: Bearer {YourAppToken}' -d '{"usernames":["user1","user2"]}' ``` #### Response example @@ -1036,7 +1051,7 @@ This API does not check whether the specified usernames are valid. If the specif ## Querying the number of offline messages -This method queries the number of offline messages a user has, and whether or not they have been delivered. +This method queries the number of offline messages a user has. For each App Key, the call frequency limit of this method is 100 per second. @@ -1058,7 +1073,7 @@ For the parameters and detailed descriptions, see [Common parameters](#param). | Parameter | Type | Description | Required | | :-------------- | :----- | :--------------------- | :------- | -| `Content-Type` | String | `application/json` | Yes | +| `Accept` | String | The parameter type. Set it as `application/json`. | Yes | | `Authorization` | String | The authentication token of the user or admin, 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 @@ -1123,7 +1138,7 @@ For the parameters and detailed descriptions, see [Common parameters](#param). | Parameter | Type | Description | Required | | :-------------- | :----- | :--------------------- | :------- | -| `Content-Type` | String | `application/json` | Yes | +| `Accept` | String | The parameter type. Set it as `application/json`. | Yes | | `Authorization` | String | The authentication token of the user or admin, 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 diff --git a/en-US/markdown/agora-chat/RESTful API Reference/agora_chat_restful_contact.md b/en-US/markdown/agora-chat/RESTful API Reference/agora_chat_restful_contact.md index 8dc2f8d8454..5308dea44ad 100644 --- a/en-US/markdown/agora-chat/RESTful API Reference/agora_chat_restful_contact.md +++ b/en-US/markdown/agora-chat/RESTful API Reference/agora_chat_restful_contact.md @@ -374,7 +374,7 @@ The request body is a JSON object, which contains the following fields: | Field | Type | Description | Required | | :-------- | :--------- | :------------------------------------------------ | :------- | -| `usernames` | An array of usernames | The usernames to be added to the block list, such as ["user1", "user2"]. You can pass in a maximum of 50 user IDs each time. | Yes | +| `usernames` | Array | The usernames to be added to the block list, such as ["user1", "user2"]. You can pass in a maximum of 50 user IDs each time. | Yes | ### HTTP response @@ -443,7 +443,7 @@ For other parameters and detailed descriptions, see [Common parameters](#param). | `pageSize` | Number | The number of users on the block list that you expect to retrieve on each page. The value range is [1,50]. | No | | `cursor` | String | Where to start getting data. | No | -
If neither `pageSize` nor `cursor` is specified, the server returns the block list of up to 500 users that are added most recently. If `pageSize` is specified and `cursor` is ignored, the server returns the block list of up to 50 users are added most recently.
+
If neither `pageSize` nor `cursor` is specified, the server returns the block list of up to 500 users that are added most recently. If `pageSize` is specified and `cursor` is ignored, the server returns the block list of up to 50 users that are added most recently.
#### Request header @@ -483,6 +483,7 @@ curl -X GET -H 'Accept: application/json' -H 'Authorization: Bearer {YourAppToke "uri": "http://XXXX/XXXX/XXXX/users/user1/blocks/users", "timestamp": 1542599978751, "entities": [], + "cursor": "MTA5OTAwMzMwNDUzNTA2ODY1NA==", "count": 2, "action": "get", "data": [ diff --git a/en-US/markdown/agora-chat/RESTful API Reference/agora_chat_restful_global_mute.md b/en-US/markdown/agora-chat/RESTful API Reference/agora_chat_restful_global_mute.md index a1a7f38640d..27439538bf1 100644 --- a/en-US/markdown/agora-chat/RESTful API Reference/agora_chat_restful_global_mute.md +++ b/en-US/markdown/agora-chat/RESTful API Reference/agora_chat_restful_global_mute.md @@ -53,7 +53,7 @@ For each App Key, the call frequency limit of this method is 100 per second. ### HTTP request ```http -POST https://{host}/{orgName}/{appName}/mutes +POST https://{host}/{org_name}/{app_name}/mutes ``` #### Path parameter @@ -74,6 +74,7 @@ For parameters and the detailed descriptions, see [Commom parameters](#param). | Parameter | Type | Description | | --- | --- | --- | | `Content-Type` | String | The content type. Set is as `application/json`. | +| `Accept` | String | The parameter type. Set it as `application/json`. | Yes | | `Authorization` | String | The authentication token of the user or admin, in the format of `Bearer ${YourAppToken}`, where `Bearer` is a fixed character, followed by an English space, and then the obtained token value. | ### HTTP response @@ -96,6 +97,7 @@ If the returned HTTP status code is not `200`, the request fails. You can refer curl -L -X POST 'https://XXXX/XXXX/XXXX/mutes' \ -H 'Authorization: Bearer {YourAppToken}' \ -H 'Content-Type: application/json' \ +-H 'Accept: application/json' \ --data-raw '{ "username": "XXXX", "chat": 100, @@ -147,7 +149,8 @@ For other parameters and the detailed descriptions, see [Commom parameters](#par | Parameter | Type | Description | | --- | --- | --- | | `Content-Type` | String | The content type. Set is as `application/json`. | -| `Authorization` | String | The authentication token of the user or admin, in the format of `Bearer ${YourAppToken}`, where `Bearer` is a fixed character, followed by an English space, and then the obtained token value. | +| `Accept` | String | The parameter type. Set it as `application/json`. | Yes | +| `Authorization` | String | The 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 @@ -158,7 +161,7 @@ If the returned HTTP status code is `200`, the request succeeds, and the respons | `userid` | String | The user ID whose global-mute settings you want to query. | | `chat` | Number | The remaining time that this user is muted in one-to-one chats, in seconds. The maximum value is 2,147,483,647.
  • > 0: The remaining time that this user is muted in one-to-one chats.
  • 0: This user is unmuted in one-to-one chats.
  • -1: This user is permanently muted in one-to-one chats.
| | `groupchat` | Number | The remaining time that this user is muted in group chats, in seconds. The maximum value is 2,147,483,647.
  • > 0: The remaining time that this user is muted in group chats.
  • 0: This user is unmuted in group chats.
  • -1: This user is permanently muted in group chats.
| -| `chatroom` | Number | The remaining time that this user is muted in group rooms, in seconds. The maximum value is 2,147,483,647.
  • > 0: The remaining time that this user is muted in chat rooms.
  • 0: This user is unmuted in chat rooms.
  • -1: This user is permanently muted in chat rooms.
| +| `chatroom` | Number | The remaining time that this user is muted in chat rooms, in seconds. The maximum value is 2,147,483,647.
  • > 0: The remaining time that this user is muted in chat rooms.
  • 0: This user is unmuted in chat rooms.
  • -1: This user is permanently muted in chat rooms.
| | `unixtime` | Number | The Unix timestamp of the current operation. | For other fields and detailed descriptions, see [Common parameters](#param). @@ -172,7 +175,8 @@ If the returned HTTP status code is not `200`, the request fails. You can refer ```shell curl -L -X GET 'https://XXXX/XXXX/XXXX/mutes/{username}' \ -H 'Authorization: Bearer {YourAppToken}' \ --H 'Content-Type: application/json' +-H 'Content-Type: application/json' \ +-H 'Accept: application/json' \ ``` #### Response example @@ -206,7 +210,7 @@ For each App Key, the call frequency limit of this method is 100 per second. ### HTTP request ```http -GET https://{host}/{orgName}/{appName}/mutes +GET https://{host}/{org_name}/{app_name}/mutes ``` #### Path parameter @@ -218,13 +222,14 @@ For parameters and the detailed descriptions, see [Common parameters](#param). | Parameter | Type | Description | | --- | --- | --- | | `Content-Type` | String | The content type. Set is as `application/json`. | +| `Accept` | String | The parameter type. Set it as `application/json`. | Yes | | `Authorization` | String | The authentication token of the user or admin, in the format of `Bearer ${YourAppToken}`, where `Bearer` is a fixed character, followed by an English space, and then the obtained token value. | #### Query parameter | Parameter | Type | Required | Description | | --- | --- | --- | --- | -| `pageNum` | Number | No | The number of pages for querying the globally muted users in the app. | +| `pageNum` | Number | No | The number of page for querying the globally muted users in the app. | | `pageSize` | Number | No | The number of data entries on each page. The value range is [1,50]. | ### HTTP response @@ -236,7 +241,7 @@ If the returned HTTP status code is `200`, the request succeeds, and the respons | `username` | String | The user ID whose global-mute settings you want to query. | | `chat` | Number | The remaining time that this user is muted in one-to-one chats, in seconds. The maximum value is 2,147,483,647.
  • > 0: The remaining time that this user is muted in one-to-one chats.
  • 0: This user is unmuted in one-to-one chats.
  • -1: This user is permanently muted in one-to-one chats.
| | `groupchat` | Number | The remaining time that this user is muted in group chats, in seconds. The maximum value is 2,147,483,647.
  • > 0: The remaining that this user in chat groups.
  • 0: This user is unmuted in chat groups.
  • -1: This user is permanently muted in chat groups.
| -| `chatroom` | Number | The remaining time that this user is muted in group rooms, in seconds. The maximum value is 2,147,483,647.
  • > 0: The remaining duration for muting this user in chat rooms.
  • 0: This user is unmuted in chat rooms.
  • -1: This user is permanently muted in chat rooms.
| +| `chatroom` | Number | The remaining time that this user is muted in chat rooms, in seconds. The maximum value is 2,147,483,647.
  • > 0: The remaining duration for muting this user in chat rooms.
  • 0: This user is unmuted in chat rooms.
  • -1: This user is permanently muted in chat rooms.
| | `unixtime` | Number | The Unix timestamp of the current operation. | For other fields and detailed descriptions, see [Common parameters](#param). @@ -250,7 +255,8 @@ If the returned HTTP status code is not `200`, the request fails. You can refer ```shell curl -L -X GET 'https://XXXX/XXXX/XXXX/mutes?pageNum=1&pageSize=10' \ -H 'Authorization: Bearer {YourAppToken}' \ --H 'Content-Type: application/json' +-H 'Content-Type: application/json' \ +-H 'Accept: application/json' \ ``` #### Response example diff --git a/en-US/markdown/agora-chat/RESTful API Reference/agora_chat_restful_message.md b/en-US/markdown/agora-chat/RESTful API Reference/agora_chat_restful_message.md index d092750faa6..92a98d8a61c 100644 --- a/en-US/markdown/agora-chat/RESTful API Reference/agora_chat_restful_message.md +++ b/en-US/markdown/agora-chat/RESTful API Reference/agora_chat_restful_message.md @@ -91,7 +91,7 @@ The request body is a JSON object, which contains the following parameters: | Parameter | Type | Description | Required | | --- | --- | --- | --- | | `from` | String | The username of the message sender. If you do not set this field, the Chat server takes the `admin` as the sender. If you set it as the empty string "", this request fails. | No | -| `to` | Array | An array of the usernames of the message recipient. For each request, you can send a message to a maximum of 600 users. Within one minute, you can send messages to a maximum of 6,000 users. | Yes | +| `to` | Array | An array of the usernames of the message recipient. For each request, you can send a message to a maximum of 600 users. Within one minute, you can send 6,000 messages. The server does not check whether the usernames you passed in exist. If the usernames you passed in do not exist, the server still sends the message instead of displaying an error. | Yes | | `type` | String | The message type:
  • `txt`: Text message
  • `img`: Image message
  • `audio`: Audio message
  • `video`: Video message
  • `file`: File message
  • `loc`: Location message
  • `cmd`: Command message
  • `custom`: Custom message
| Yes | | `body` | JSON | The message content. For different message types, this parameter contains different fields. For details, see [Body of different message types](#body). | Yes | | `roam_ignore_users` | List | No | Which users cannot obtain such message when they pull messages from the server. A maximum of 20 users can be passed in each time. | @@ -438,7 +438,7 @@ The request body is a JSON object, which contains the following parameters: | Parameter | Type | Description | Required | | --- | --- | --- | --- | -| `to` | Array | An array of the group IDs that receives the message. Within one second, you can send a maximum of 20 messages to a chat group, and for each request, you can send messages to a maximum of 3 chat groups. | Yes | +| `to` | Array | An array of the group IDs that receives the message. Within one second, you can send a maximum of 20 messages to chat groups, and for each request, you can send messages to a maximum of 3 chat groups. | Yes | | `need_group_ack` | Boolean | Whether read receipts are required after the message is sent:
  • `true`: Yes.
  • `false: No.`
| No | The other parameters and descriptions are the same with those of [Sending a one-to-one message method](#request). @@ -750,7 +750,7 @@ The request body is a JSON object, which contains the following parameters: | Parameter | Type | Description | Required | | --- | --- | --- | --- | -| `to` | Array | An array of the chat room IDs that receives the message. Within one second, you can send messages to a maximum of 100 chat rooms, and for each request, you can send messages to a maximum of 10 chat rooms. | Yes | +| `to` | Array | An array of the chat room IDs that receive the message. Within one second, you can send messages to a maximum of 100 chat rooms, and for each request, you can send messages to a maximum of 10 chat rooms. | Yes | | `chatroom_msg_level` | String | The chat room message priority:
  • `high`
  • (Default) `normal`
  • `low`
| No | The other parameters and descriptions are the same with those of [Sending a one-to-one message method](#request). @@ -1303,7 +1303,7 @@ For the parameters and detailed descriptions, see [Common parameters](#param). | Parameter | Type | Description | Required | | :---------------- | :----- | :--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :------- | -| `Content-Type` | String | The content type. Pass `multipart/form-data` | Yes | +| `Content-Type` | String | The content type. Pass `multipart/form-data`. | Yes | | `Authorization` | String | The authentication token of the user or admin, in the format of `Bearer ${YourAppToken}`, where `Bearer` is a fixed character, followed by an English space, and then the obtained token value. | Yes | | `restrict-access` | Bool | Whether to restrict access to this file.
  • `true`: Restrict access to the file. The user needs to provide a file access key (`share-secret`) to download the file. You can obtain the access key from the response body.
  • `false`: The access is not restricted. Users can download the file directly.
| No | | `thumbnail-height` | Number | The height of the image thumbnail, in pixels. This parameter is valid only if the size of the uploaded image exceeds 10 KB. If you leave this parameter empty, the height is 170 pixels by default. | No | @@ -1412,6 +1412,8 @@ If the returned HTTP status code is not `200`, the request fails. You can refer curl -X GET -H 'Accept: application/octet-stream' -H 'Authorization: Bearer {YourToken}' -H 'share-secret: f0Vr-uyyEeiHpHmsu53XXXXXXXXZYgyLkdfsZ4xo2Z0cSBnB' 'http://XXXX/XXXX/XXXX/chatfiles/7f456bf0-XXXX-XXXX-b630-777db304f26c'-o /Users/test/chat/image/image.JPG ``` +Note that `/Users/test/easemob/image/image.JPG` is the local path to store the file. You need to replace the path with your own local file path, or the request fails. + #### Response example ```json @@ -1422,7 +1424,7 @@ curl -X GET -H 'Accept: application/octet-stream' -H 'Authorization: Bearer {You ## Download a thumbnail -When uploading an image or video file, the Chat server can create a thumbnail for the file. This method has an extra `thumbnail:true` field in the request header compared with [downloading a file](#download). +When receiving an image or video message, you can download the thumbnail of the image or video first, and then the original file as required. The only difference between downloading thumbnails and original files is that the former has an extra `thumbnail:true` field in the request header. When the server receives a request header containing this field, it returns the thumbnail, otherwise it returns the original file. For each App Key, the call frequency limit of this method is 100 per second. @@ -1449,6 +1451,7 @@ For the other parameters and detailed descriptions, see [Common parameters](#par | `Accept` | String | `application/octet-stream`, which means to download files in binary data stream format. | Yes | | `Authorization` | String | Bearer ${YourAppToken} | Yes | | `thumbnail` | Bool | Whether to download the thumbnail of the image or video file.
  • `true`: Yes.
  • `false`: (Default) No. Download the original file instead.
| No. | +| `share-secret` | String | The file access key for downloading the thumbnail. After the thumbnail is uploaded successfully using the [Upload the file](#upload) method, you can obtain the access key from the response body of `upload`. | This field is mandatory if you set `restrict-access` to `true` when uploading the file. | ### HTTP response @@ -1495,7 +1498,7 @@ GET https://{host}/{org_name}/{app_name}/chatmessages/${time} | Parameter | Type | Description | Required | | :----- | :----- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | :------- | -| `time` | String | The start time of the historical messages to query. UTC time, using the ISO8601 standard, in the format of `yyyyMMddHH`.
For example, if `time` is` 2018112717`, it means to query historical messages from 17:00 on November 27, 2018 to 18:00 on November 27, 2018. | Yes | +| `time` | String | The start time of the historical messages to query. UTC time in the format of `yyyyMMddHH`.
For example, if `time` is` 2018112717`, it means to query historical messages from 17:00 on November 27, 2018 to 18:00 on November 27, 2018. | Yes | For other parameters and detailed descriptions, see [Common parameters](#param). @@ -1558,10 +1561,12 @@ The data format for historical messages are JSON, which contains the following f | --- | --- | --- | | `msg_id` | String | The message ID. | | `timestamp` | Long | The UTC Unix timestamp when the message is sent, in miliseconds. | -| `from` | String | The username that sends the message. | -| `to` | String | The message recipient.
  • For a one-to-one chat, this parameter indicates the peer user that receives the message.
  • For a group chat, this parameter indicates the chat group ID.
| +| `from` | String | Internal field. You can safely ignore it. | +| `to` | String | Internal field. You can safely ignore it. | | `chat_type` | String | The chat type:
  • `chat`: One-to-one chat.
  • `groupchat`: Group chat.
  • `chatroom`: Chat room.
| -| `payload` | JSON | The content of the message, including message extensions and customzied message attributes. | +| `payload` | JSON | The content of the message, including message extensions and customized message attributes. | +| `payload.from` | String | The username that sends the message. | +| `payload.to` | String | The message recipient.
  • For a one-to-one chat, it indicates the peer user that receives the message.
  • For a group chat, it indicates the chat group ID.
  • For a room chat, it indicates the chat room ID.
| ```json { @@ -1705,7 +1710,7 @@ The fields of `bodies` for different message types vary: | `thumb` | String | The URL address of the video thumbnail. | | `thumb_secret` | String | The thumbnail file access key.
This field exists if you set the access restriction when calling the [upload-file](#upload) method. | | `type` | String | The message type. For video messages, set it as `video`. | - | `url` | String | The URL address of the video file. You can visit this URL to download video files. | + | `url` | String | The URL address of the vide o file. You can visit this URL to download video files. | Example: @@ -1780,26 +1785,77 @@ The fields of `bodies` for different message types vary: | Field | Type | Description | | :------------ | :----- | :----------------------------------------------- | - | `customExts` | JSON | The custom extension properties. You can set the fields in the extension properties yourself. | + | `customExts`/`v2:customExts` | JSON | The custom extension properties. You can set the fields in the extension properties yourself. `customExts`: The old parameter. It is of the Array type and can contain up to 16 elements. `v2:customExts`: The new parameter. It is of the Map type and can contain up to 16 elements. You are recommended to use this new parameter. | | `customEvent` | String | The custom event type. | | `type` | String | The message type. For custom messages, set it as `custom`. | Example: ```json - { - "bodies": [ - { - "customExts": { - "name": "flower", - "size": "16", + "bodies": + [ + { + "v2:customExts": { + "name": "flower", + "size": "16", + "price": "100" + }, + "customExts": [ + { + "name": "flower" + }, + { + "size": "16" + }, + { "price": "100" + } + ], + "customEvent": "gift_1", + "type": "custom" + } + ] + ``` + +- Combined message + + | Parameter | Type | Description | + | :------------- | :----- | :----------------------------------------------------------- | + | `combineLevel` | Int | The number of layers of messages included in the combined message. | + | `file_length` | Int | The attachment size of the combined message, in the unit of bytes. | + | `filename` | String | The attachment name of the combined message. | + | `secret` | String | The key for accessing the attachment of the combined message. br>This field exists if you set the access restriction when calling the [upload-file](#upload) method. | + | `subType` | String | The message type, `sub_combine`, indicating the combined message. | + | `summary` | String | The summary of the combined message. | + | `title` | String | The title of the combined message. | + | `url` | String | The URL of the attachment of the combined message. You can download the attachment from the URL. | + + For example, the combined message includes a text message, an image message, and a file message. + + ```json + "bodies": + [ + { + "v2:customExts": { + "name": "flower", + "size": "16", + "price": "100" + }, + "customExts": [ + { + "name": "flower" }, - "customEvent": "gift_1", - "type": "custom" - } - ] - } + { + "size": "16" + }, + { + "price": "100" + } + ], + "customEvent": "gift_1", + "type": "custom" + } + ] ``` ## Modify a text or custom message @@ -1859,7 +1915,7 @@ If the returned HTTP status code is not `200`, the request fails. Common errors | Error | HTTP Status Code | Code Information | Error Description | | :-------- | :----- | :------ |:----- | -| `UnsupportedMessageTypeException` | 400 | The message is of a type that is currently not supported for modification. | This type of message cannot be modified. Currently, only text messages and custom messages that are successful sent can be modified. | +| `UnsupportedMessageTypeException` | 400 | The message is of a type that is currently not supported for modification. | This type of message cannot be modified. Currently, only text messages and custom messages that are successfully sent can be modified. | | `InvalidMessageIdException` | 400 | The provided message ID is not a valid number. | The message ID can only contain digits. | | `RewriteMessageNotAuthorizedException` | 401 | You are not authorized to edit this message. | The ID of the message to be modified does not belong to the current app. | | `EditLimitExceededException` | 403 | The message has reached its edit limit and cannot be modified further. | The number of times the message is modified has reached the upper limit which is 10. | @@ -1964,9 +2020,10 @@ For the parameters and detailed descriptions, see [Common parameters](#param). | `msg_id` | String | Yes | The ID of the message to recall. As only one message can be recalled each time, you can pass in only one message ID. | | `to` | String | Yes | The user, chat group, or chat room that receives the message to recall. You can specify a user ID, a chat group ID, or a chat room ID.
**Note**: If the message to recall no longer exists on the server, only the message on the recipient client is recalled. | | `chat_type` | String | Yes | The type of the chat where the message to recall is sent.
  • `chat`: An one-on-one chat.
  • `groupchat`: A chat group.
  • `chatroom`: A chat room.
| -| `from` | String | No | The user who recalls the message. By default, the recaller is the app admin. You can also specify another user as the recaller. | +| `from` | String | No | The user who recalls the message. By default, the value is `admin`. You can also specify another user as the recaller. | | `sync_device` | Bool| No | Whether to synchronize the recall of a one-to-one message to all online devices of the message sender.
  • (Default) `true`: Yes
  • `false`: No
When `force` is set to `true`, to recall a message that expires, you need to set `from` to the sender of the message.
| | `force` | Bool | No | Whether to allow to recall messages forcibly:
  • `true`: Yes. In this case, you can recall messages whether they expire. To recall the expired messages, you must set `force` to `true`.
  • (Default) `false`: No. In this case, you can only recall messages that still exist on the server within the recall duration.
| +| `recallMessageExtensionInfo` | String | No | The extension information for message recall. | ### HTTP response @@ -1978,7 +2035,7 @@ If the returned HTTP status code is `200`, the request succeeds, and the respons | :--------- | :--------- | :----------------------------------------------------------- | | `msg_id` | String | The ID of the recalled message. | | `recalled` | String | Returns `yes` if the request is successful. | -| `from` | String | The user who recalls the message. By default, the recaller is the app admin. | +| `from` | String | The user who recalls the message. | | `to` | String | The user, chat group, or chat room that receives the recalled message. | | `chattype` | String | The type of the chat where the recalled message is located.
  • `chat`: An one-on-one chat.
  • `group_chat`: A chat group.
  • `chatroom`: A chat room.
| @@ -1999,7 +2056,8 @@ curl -i -X POST -H 'Content-Type: application/json' -H 'Accept: application/json "to": "user2", "from": "user1", "chat_type": "chat", - "force": true + "force": true, + "recallMessageExtensionInfo": "{\"type\": \"chat\"}" }' ``` @@ -2072,15 +2130,17 @@ For the other parameters and detailed descriptions, see [Common parameters](#par | Parameter | Type | Required | Description | | :-------------- | :------- | :------- | :----------------------------------------------------------- | +| `Content-Type` | String | Yes | `application/json` | +| `Accept` | String | Yes | The content type. Set it to `application/json`. | | `Authorization` | String | Yes | The authentication token of the user or admin, in the format of `Bearer ${YourAppToken}`, where `Bearer` is a fixed character, followed by an English space, and then the obtained token value. | #### Request body | Parameter | Type | Required | Description | | :------------ | :------- | :------- | :----------------------------------------------------------- | -| `channel` | String | Yes | The ID of the conversation that you want to delete. | +| `channel` | String | Yes | The ID of the conversation that you want to delete.
  • If `type` is `chat`, the conversation ID is the user ID of the peer user.
  • If `type` is `groupchat`, the conversation ID is the chat room ID.
| | `type` | String | Yes | The type of the chat.
  • `chat`: An one-on-one chat.
  • `groupchat`: A group chat.
| -| `delete_roam` | Bool | Yes | Whether to delete the chat from the server:
  • `true`: Yes.
  • `false`: No.
| +| `delete_roam` | Bool | Yes | Whether to delete the roaming messages of the conversation from the server:
  • `true`: Yes.
  • `false`: No.
| ### HTTP response @@ -2142,6 +2202,8 @@ POST https://{host}/{orgName}/{appName}/messages/users/import | Parameter | Type | Required | Description | | :-------------- | :------- | :------- | :----------------------------------------------------------- | +| `Content-Type` | String | Yes | `application/json` | +| `Accept` | String | Yes | The content type. Set it to `application/json`. | | `Authorization` | String | Yes | The authentication token of the user or admin, in the format of `Bearer ${YourAppToken}`, where `Bearer` is a fixed character, followed by an English space, and then the obtained token value. | @@ -2180,7 +2242,11 @@ If the request fails, refer to [Status codes](./agora_chat_status_code?platform= ```shell # Replace {YourToken} with the app token generated on your server - curl -X POST -H "Authorization: Bearer {YourToken}" "https://XXXX/XXXX/XXXX/messages/users/import" -d '{ + curl -X POST "https://XXXX/XXXX/XXXX/messages/users/import" \ + -H 'Authorization: Bearer ' \ + -H 'Content-Type: application/json' \ + -H 'Accept: application/json' \ + -d '{ "target": "username2", "type": "txt", "body": { @@ -2199,7 +2265,11 @@ If the request fails, refer to [Status codes](./agora_chat_status_code?platform= ```shell # Replace {YourToken} with token generated on your server - curl -X POST -H "Authorization: Bearer {YourToken}" "https://XXXX/XXXX/XXXX/messages/users/import" -d '{ + curl -X POST "https://XXXX/XXXX/XXXX/messages/users/import" + -H 'Authorization: Bearer ' \ + -H 'Content-Type: application/json' \ + -H 'Accept: application/json' \ + -d '{ "target": "username2", "type": "img", "body": { @@ -2253,6 +2323,8 @@ POST https://{host}/{orgName}/{appName}/messages/chatgroups/import | Parameter | Type | Required | Description | | :-------------- | :------- | :------- | :----------------------------------------------------------- | +| `Content-Type` | String | Yes | `application/json` | +| `Accept` | String | Yes | The content type. Set it to `application/json`. | | `Authorization` | String | Yes | The authentication token of the user or admin, in the format of `Bearer ${YourAppToken}`, where `Bearer` is a fixed character, followed by an English space, and then the obtained token value. | #### Request body @@ -2290,7 +2362,11 @@ If the request fails, refer to [Status codes](./agora_chat_status_code?platform= ```shell # Replace {YourAppToken} with the app token generated on your server - curl -X POST -H "Authorization: Bearer " "https://XXXX/XXXX/XXXX/messages/chatgroups/import" -d '{ + curl -X POST "https://XXXX/XXXX/XXXX/messages/chatgroups/import" + -H 'Authorization: Bearer ' \ + -H 'Content-Type: application/json' \ + -H 'Accept: application/json' \ + -d '{ "target": "1123376564212", "type": "txt", "body": { diff --git a/en-US/markdown/agora-chat/RESTful API Reference/agora_chat_restful_presence.md b/en-US/markdown/agora-chat/RESTful API Reference/agora_chat_restful_presence.md index 559d5450d57..3eea1512cc4 100644 --- a/en-US/markdown/agora-chat/RESTful API Reference/agora_chat_restful_presence.md +++ b/en-US/markdown/agora-chat/RESTful API Reference/agora_chat_restful_presence.md @@ -55,6 +55,7 @@ For the descriptions of the other path parameters, see [Common Parameters](#para | Parameter | Type | Description | Required | |:---------------| :------ | :------- |:------------------| | `Content-Type` | String | The content type. Set it to `application/json`. | Yes | +| `Accept` | String | The parameter type. Set it as `application/json`. | Yes | | `Authorization` | String | The 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 @@ -79,10 +80,11 @@ If the returned HTTP status code is not `200`, the request fails. You can refer #### Request example -```json +```shell curl -X POST 'http://XXXX/XXXX/XXXX/users/c1/presence/android_123423453246/0' \ -H 'Authorization: Bearer ' \ -H 'Content-Type: application/json' \ +-H 'Accept: application/json' \ -d '{"ext":"123"}' ``` @@ -118,6 +120,7 @@ For the descriptions of the other path parameters, see [Common Parameters](#para | Parameter | Type | Description | Required | |:---------------| :------ | :------- |:------------------| | `Content-Type` | String | The content type. Set it to `application/json`. | Yes | +| `Accept` | String | The parameter type. Set it as `application/json`. | Yes | | `Authorization` | String | The 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 @@ -136,7 +139,7 @@ If the returned HTTP status code is `200`, the request succeeds, and the data fi | :------- |:-------------|:-------------| | `result` | JSON | Whether the subscription succeeds. If successful, the presence statuses of the users return; otherwise, you can troubleshoot according to the returned reasons. | | `uid` | String | The unique login account of the user. | -| `last_time` | Number | The Unix timestamp when the user was last online, in seconds. | +| `last_time` | Number | The Unix timestamp when the user was last online, in seconds. The server records the time when the subscribed user logs in or out. | | `expiry` | Number | The Unix timestamp when the subscription expires, in seconds. | | `ext` | String | The extension information of the presence status. | | `status` | JSON | The presence statuses on multiple devices of the user.
  • `0`: Offline.
  • `1`: Online.
  • Other strings: User-defined custom presence status.
| @@ -147,10 +150,11 @@ If the returned HTTP status code is not `200`, the request fails. You can refer #### Request example -```json +```shell curl -X POST 'http://XXXX/XXXX/XXXX/users/wzy/presence/1000' \ -H 'Authorization: Bearer ' \ -H 'Content-Type: application/json' \ +-H 'Accept: application/json' \ -d '{"usernames":["c2","c3"]}' ``` @@ -188,6 +192,7 @@ For other parameters and descriptions, see [Common Parameters](#param). | Parameter | Type | Description | Required | |:---------------| :------ | :------- |:------------------| | `Content-Type` | String | The content type. Set it to `application/json`. | Yes | +| `Accept` | String | The parameter type. Set it as `application/json`. | Yes | | `Authorization` | String | The 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 @@ -216,10 +221,11 @@ If the returned HTTP status code is not `200`, the request fails. You can refer #### Request example -```json +```shell curl -X POST 'http://XXXX/XXXX/XXXX/users/wzy/presence' \ -H 'Authorization: Bearer ' \ -H 'Content-Type: application/json' \ +-H 'Accept: application/json' \ -d '{"usernames":["c2","c3"]}' ``` @@ -268,6 +274,7 @@ For other parameters and descriptions, see [Common Parameters](#param). | Parameter | Type | Description | Required | |:---------------| :------ | :------- |:------------------| | `Content-Type` | String | The content type. Set it to `application/json`. | Yes | +| `Accept` | String | The parameter type. Set it as `application/json`. | Yes | | `Authorization` | String | The 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 @@ -292,10 +299,11 @@ If the returned HTTP status code is not `200`, the request fails. You can refer #### Request example -```json +```shell curl -X DELETE 'http://XXXX/XXXX/XXXX/users/wzy/presence' \ -H 'Authorization: Bearer ' \ -H 'Content-Type: application/json' \ +-H 'Accept: application/json' \ -d '["c1"]' ``` @@ -314,14 +322,14 @@ For each App Key, the call frequency limit of this method is 50 per second. ### HTTP request ```http -GET https://{host}/{org_name}/{app_name}/users/{uid}/presence/sublist?pageNum=1&pageSize=100 +GET https://{host}/{org_name}/{app_name}/users/{uid}/presence/sublist?pageNum={pagenumber}&pageSize={pagesize} ``` #### Path parameter | Parameter | Type | Description | Required | |:---------------| :------ | :------- |:------------------| -| `uid` | String | The user for which the subscriptions are retrieved. | Yes | +| `uid` | String | The user for which the subscriptions are retrieved. If the user ID you passed in does not exist or the user does not subscribe to the presence status of any users, an empty list is returned. | Yes | For other parameters and descriptions, see [Common Parameters](#param). @@ -337,6 +345,7 @@ For other parameters and descriptions, see [Common Parameters](#param). | Parameter | Type | Description | Required | |:---------------| :------ | :------- |:------------------| | `Content-Type` | String | The content type. Set it to `application/json`. | Yes | +| `Accept` | String | The parameter type. Set it as `application/json`. | Yes | | `Authorization` | String | The 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 @@ -359,10 +368,11 @@ If the returned HTTP status code is not `200`, the request fails. You can refer #### Request example -```json +```shell curl -X GET 'http://XXXX/XXXX/XXXX/users/wzy/presence/sublist?pageNum=1&pageSize=100' \ -H 'Authorization: Bearer ' \ --H 'Content-Type: application/json' +-H 'Content-Type: application/json' \ +-H 'Accept: application/json' ``` #### Response example diff --git a/en-US/markdown/agora-chat/RESTful API Reference/agora_chat_restful_reaction.md b/en-US/markdown/agora-chat/RESTful API Reference/agora_chat_restful_reaction.md index f42dec7ca99..d676b2f3737 100644 --- a/en-US/markdown/agora-chat/RESTful API Reference/agora_chat_restful_reaction.md +++ b/en-US/markdown/agora-chat/RESTful API Reference/agora_chat_restful_reaction.md @@ -70,7 +70,7 @@ For other parameters and the detailed descriptions, see [Common parameters](#par | Parameter | Type | Description | | :-------------- | :----- | :---------------------------------- | | `msg_Id` | String | The message ID to which you want to add the reaction. | -| `message` | String | The ID of the emoji, same as that on the client. The maximum length is 128 characters. | +| `message` | String | The ID of the emoji, same as that on the client. The maximum length is 128 characters. This parameter has no restriction on character set types. If special characters are used, you need to use URL encoding for the special characters when retrieving or deleting the reactions.| ### HTTP Response @@ -154,7 +154,6 @@ For other parameters and the detailed descriptions, see [Common parameters](#par | Parameter | Type | Description | Required | | :-------------- | :----- | :---------------------------------- | :------- | -| `Content-Type` | String | `application/x-www-form-urlencoded` | Yes | | `Authorization` | String | The authentication token of the user or admin, 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 @@ -231,7 +230,7 @@ This method deletes a reaction. ### HTTP request ```shell -DELETE https://{host}/{org_name}/{app_name}/reaction/user/{userId} +DELETE https://{host}/{org_name}/{app_name}/reaction/user/{userId}?msgId={msgId}&message={message} ``` #### Path parameter @@ -246,8 +245,7 @@ For other parameters and the detailed descriptions, see [Common parameters](#par | Parameter | Type | Description | Required | | :-------------- | :----- | :---------------------------------- | :------- | -| `Content-Type` | String | `application/x-www-form-urlencoded` | Yes | -| `Authorization` | String | The authentication token of the user or admin, in the format of `Bearer ${YourAppToken}`, where `Bearer` is a fixed character, followed by an English space, and then the obtained token value. | Yes | +| `Authorization` | String | The authentication token of the admin, in the format of `Bearer ${YourAppToken}`, where `Bearer` is a fixed character, followed by an English space, and then the obtained token value. | Yes | #### Query parameters @@ -321,7 +319,6 @@ For other parameters and the detailed descriptions, see [Common parameters](#par | Parameter | Type | Description | Required | | :-------------- | :----- | :---------------------------------- | :------- | -| `Content-Type` | String | `application/x-www-form-urlencoded` | Yes | | `Authorization` | String | The authentication token of the user or admin, 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 @@ -352,8 +349,8 @@ If the returned HTTP status code is not `200`, the request fails. You can refer // Starts querying from the first page curl -g -X GET 'http://XXXX/XXXX/XXXX/reaction/user/wz/detail?msgId=997627787730750008&message=emoji_40&limit=50' -H 'Authorization: Bearer {YourAppToken}' -// Starts querying from the second page -curl -g -X GET 'http://XXXX/XXXX/XXXX/reaction/user/wz/detail?msgId=997627787730750008&message=emoji_40&cursor=944330529971449164&limit=50' -H 'Authorization: Authorization: Bearer {YourAppToken}' +// Starts querying from page N +curl -g -X GET 'http://XXXX/XXXX/XXXX/reaction/user/wz/detail?msgId=997627787730750008&message=emoji_40&cursor=944330529971449164&limit=50' -H 'Authorization: Bearer {YourAppToken}' ``` #### Response example diff --git a/en-US/markdown/agora-chat/RESTful API Reference/agora_chat_restful_user_attributes.md b/en-US/markdown/agora-chat/RESTful API Reference/agora_chat_restful_user_attributes.md index ac5ca57fcf7..53bd1b7beda 100644 --- a/en-US/markdown/agora-chat/RESTful API Reference/agora_chat_restful_user_attributes.md +++ b/en-US/markdown/agora-chat/RESTful API Reference/agora_chat_restful_user_attributes.md @@ -1,4 +1,4 @@ -User attributes refers to the label information added for the user, including key-value pairs. +User attributes refers to the user information, including user nickname, avatar, email address, mobile numbers, sex, signature, and birth date. The user attributes are added as key-value pairs. This page shows how to call Agora Chat RESTful APIs to manage user attributes, including adding, deleting, modifying, and retrieving user attributes. @@ -73,7 +73,7 @@ For the parameters and detailed descriptions, see [Common parameters](#param). #### Request body -The request body is in the format of JSON String. The request body contains the following fields: +The request body is in the format of `www-form-urlencoded`. The request body contains the following fields: | Field | Type | Description | Required | | :------ | :----- | :----- | :------- | @@ -152,7 +152,7 @@ For the parameters and detailed descriptions, see [Common parameters](#param). | Parameter | Type | Description | Required | | :-------------- | :----- | :--------------------- | :------- | -| `Content-Type` | String | `application/json` | Yes | +| `Accept` | String | The parameter type. Set it as `application/json`. | Yes | | `Authorization` | String | The authentication token of the user or admin, 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 @@ -175,7 +175,7 @@ If the returned HTTP status code is not `200`, the request fails. You can refer ```shell # Replace {YourAppToken} with the app token generated in your server. -curl -X GET -H 'Authorization: Bearer {YourAppToken}' -H 'Content-Type: application/json''http://XXXX/XXXX/XXXX/metadata/user/XXXX' +curl -X GET -H 'Accept: application/json' -H 'Authorization: Bearer {YourAppToken}''http://XXXX/XXXX/XXXX/metadata/user/XXXX' ``` #### Response example @@ -213,6 +213,7 @@ For the parameters and detailed descriptions, see [Common parameters](#param). | Parameter | Type | Description | Required | | :-------------- | :----- | :--------------------- | :------- | | `Content-Type` | String | `application/json` | Yes | +| `Accept` | String | The parameter type. Set it as `application/json`. | Yes | | `Authorization` | String | The authentication token of the user or admin, 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 @@ -244,7 +245,7 @@ If the returned HTTP status code is not `200`, the request fails. You can refer ```shell # Replace {YourAppToken} with the app token generated in your server. -curl -X POST -H 'Authorization: Bearer {YourAppToken}' -H 'Content-Type: application/json' -d '{ +curl -X POST -H 'Accept: application/json' -H 'Authorization: Bearer {YourAppToken}' -H 'Content-Type: application/json' -d '{ "properties": [ "avatar", "ext", @@ -304,6 +305,7 @@ For the parameters and detailed descriptions, see [Common parameters](#param). | Parameter | Type | Description | Required | | :-------------- | :----- | :--------------------- | :------- | +| `Accept` | String | The parameter type. Set it as `application/json`. | Yes | | `Authorization` | String | The authentication token of the user or admin, 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 @@ -325,7 +327,7 @@ If the returned HTTP status code is not `200`, the request fails. You can refer #### Request example ```shell -curl -X GET -H 'Authorization: Bearer {YourAppToken}''http://XXXX/XXXX/XXXX/metadata/user/capacity' +curl -X GET -H 'Accept: application/json' -H 'Authorization: Bearer {YourAppToken}''http://XXXX/XXXX/XXXX/metadata/user/capacity' ``` #### Response example @@ -358,6 +360,7 @@ For the parameters and detailed descriptions, see [Common parameters](#param). | Parameter | Type | Description | Required | | :-------------- | :----- | :--------------------- | :------- | +| `Accept` | String | The parameter type. Set it as `application/json`. | Yes | | `Authorization` | String | The authentication token of the user or admin, 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 @@ -379,7 +382,7 @@ If the returned HTTP status code is not `200`, the request fails. You can refer #### Request example ```shell -curl -X DELETE -H 'Authorization: Bearer {YourAppToken}' 'http://XXXX/XXXX/XXXX/metadata/user/XXXX' +curl -X DELETE -H 'Accept: application/json' -H 'Authorization: Bearer {YourAppToken}' 'http://XXXX/XXXX/XXXX/metadata/user/XXXX' ``` #### Response example