Skip to content

Commit

Permalink
Modify REST API Doc
Browse files Browse the repository at this point in the history
  • Loading branch information
haoxiuwen committed Oct 23, 2023
1 parent b1764fc commit 3ae6d8b
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 22 deletions.
8 changes: 4 additions & 4 deletions docs/document/server-side/chatroom.md
Original file line number Diff line number Diff line change
Expand Up @@ -125,9 +125,9 @@ POST https://{host}/{org_name}/{app_name}/chatrooms/super_admin
```shell
# 将 <YourAppToken> 替换为你在服务端生成的 App Token

curl -X POST 'https://XXXX/XXXX/XXXX//chatrooms/super_admin'
-H 'Authorization: Bearer <YourAppToken>'
-H 'Content-Type: application/json'
curl -X POST 'https://XXXX/XXXX/XXXX/chatrooms/super_admin' \
-H 'Authorization: Bearer <YourAppToken>' \
-H 'Content-Type: application/json' \
-d '{
"superadmin": "user1"
}'
Expand Down Expand Up @@ -1247,7 +1247,7 @@ DELETE https://{host}/{org_name}/{app_name}/metadata/chatroom/{chatroom_id}/user
```shell
# 将 <YourAppToken> 替换为你在服务端生成的 App Token

DELETE -X POST -H 'Content-Type: application/json' -H 'Accept: application/json' -H 'Authorization: Bearer <YourAppToken>' -d '{
curl -X DELETE -H 'Content-Type: application/json' -H 'Accept: application/json' -H 'Authorization: Bearer <YourAppToken>' -d '{
"keys": ["key1","key2"]
}' 'https://XXXX/XXXX/XXXX/metadata/chatroom/662XXXX13/user/user1/forced'
```
Expand Down
28 changes: 14 additions & 14 deletions docs/document/server-side/group.md
Original file line number Diff line number Diff line change
Expand Up @@ -399,7 +399,7 @@ GET https://{host}/{org_name}/{app_name}/chatgroups?limit={N}&cursor={cursor}

| 参数 | 类型 | 是否必需 | 描述 |
| :------- | :----- | :------- | :---------------------------------------------------------- |
| `limit` | Int || 每次期望返回的群组数量。取值范围为 [1,100],默认值为 `10`|
| `limit` | Int || 每次期望返回的群组数量。取值范围为 [1,1000],默认值为 `10`|
| `cursor` | String || 数据查询的起始位置。 |

:::tip
Expand Down Expand Up @@ -494,7 +494,7 @@ curl -X GET -H 'Accept: application/json' -H 'Authorization: Bearer <YourAppToke
#### HTTP 请求

```http
GET https://{host}/{org_name}/{app_name}/chatgroups/users/{username}?pagesize={}&pagenum={}
GET https://{host}/{org_name}/{app_name}/chatgroups/user/{username}?pagesize={}&pagenum={}
```

##### 路径参数
Expand All @@ -505,7 +505,7 @@ GET https://{host}/{org_name}/{app_name}/chatgroups/users/{username}?pagesize={}

| 参数 | 类型 | 是否必需 | 描述 |
|:--------------| :----- |:--------|:-------------------|
| `pagesize` | String || 每页获取的群组数量。取值范围为 [1,20],默认值为 `10`|
| `pagesize` | String || 每页获取的群组数量。取值范围为 [1,20],默认值为 `5`|
| `pagenum` | String || 当前页码。默认从第 `0` 页开始获取。 |

##### 请求 header
Expand Down Expand Up @@ -586,7 +586,7 @@ curl --location 'http://XXXX/XXXX/XXXX/chatgroups/user/XXXX' \
#### HTTP 请求

```http
POST https://{host}/{org_name}/{app_name}/chatgroups/{group_id}/user/{username}/is_joined
GET https://{host}/{org_name}/{app_name}/chatgroups/{group_id}/user/{username}/is_joined
```

##### 路径参数
Expand Down Expand Up @@ -1278,7 +1278,7 @@ GET https://{host}/{org_name}/{app_name}/chatgroups/{group_id}/users?pagenum={N}
| 参数 | 类型 | 是否必需 | 描述 |
| :--------- | :--- | :------- | :---------------------------------------------------------- |
| `pagenum` | Int || 当前页码。默认从第 1 页开始获取。 |
| `pagesize` | Int || 每页期望返回的群组成员数量。取值范围为 [1,100]。默认为 10|
| `pagesize` | Int || 每页期望返回的群组成员数量。取值范围为 [1,1000]。默认为 `1000`|

##### 请求 header

Expand Down Expand Up @@ -1696,11 +1696,11 @@ PUT https://{host}/{org_name}/{app_name}/metadata/chatgroup/{group_id}/user/{use

```shell
# 将 <YourAppToken> 替换为你在服务端生成的 App Token
curl --location --request PUT 'https://a1-hsb.easemob.com/easemob-demo/testy/metadata/chatgroup/207059303858177/user/test2' \
curl --location --request PUT 'https://XXXX/XXXX/XXXX/metadata/chatgroup/XXXX/user/XXXX' \
-H 'Content-Type: application/json' \
-H 'Accept: application/json'
-H 'Authorization: Bearer YWMtozZwfsFFEe2oQTE6aob5eQAAAAAAAAAAAAAAAAAAAAExCXvf5bRGAJBgXNYFJVQ9AQMAAAGG2MUClwBPGgDsI1GYg1QtapTEdGyrm29Eu6L8qx60lDZ9TJRDOQjEsw' \
--data-raw '{
-H 'Accept: application/json' \
-H 'Authorization: Bearer <YourAppToken>' \
-d '{
"metaData": {
"key1": "value1"
}
Expand Down Expand Up @@ -1829,11 +1829,11 @@ POST https://{host}/{org_name}/{app_name}/metadata/chatgroup/{group_id}/get

```shell
# 将 <YourAppToken> 替换为你在服务端生成的 App Token
curl --location --request POST 'https://a1-hsb.easemob.com/easemob-demo/testy/metadata/chatgroup/207059303858177/get' \
-H 'Content-Type: application/json' \
-H 'Accept: application/json'
-H 'Authorization: Bearer YWMtozZwfsFFEe2oQTE6aob5eQAAAAAAAAAAAAAAAAAAAAExCXvf5bRGAJBgXNYFJVQ9AQMAAAGG2MUClwBPGgDsI1GYg1QtapTEdGyrm29Eu6L8qx60lDZ9TJRDOQjEsw' \
--data-raw '{
curl--location--request POST 'https://XXXX/XXXX/XXXX/metadata/chatgroup/XXXX/get'\
-H'Content-Type: application/json'\
-H'Accept: application/json'\
-H'Authorization: Bearer <YourAppToken>'\
-d '{
"targets":["test1","test2"],
"properties":["key1","key2"]
}'
Expand Down
6 changes: 5 additions & 1 deletion docs/document/server-side/message_download.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,11 @@ POST https://{host}/{org_name}/{app_name}/chatfiles

```shell
# 将 <YourAppToken> 替换为你在服务端生成的 App Token,将 file 的路径替换为待上传文件所在的本地完整路径
curl -X POST https://XXXX/XXXX/XXXX/chatfiles -H 'Authorization: Bearer <YourAppToken>' -H 'content-type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW' -H 'restrict-access: true' -F file=@/Users/test/9.2/easemob/image/IMG_2953.JPG
curl L -X POST 'https://XXXX/XXXX/XXXX/chatfiles' \
-H 'Authorization: Bearer <YourAppToken>' \
-H 'Content-Type: multipart/form-data; boundary=---WebKitFormBoundary7MA4YWxkTrZu0gW' \
-H 'restrict-access: true' \
-F 'file="@/Users/test/9.2/easemob/image/IMG_2953.JPG"'
```

#### 响应示例
Expand Down
4 changes: 2 additions & 2 deletions docs/document/server-side/message_import.md
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ POST https://{host}/{org_name}/{app_name}/messages/chatgroups/import
```shell
# 将 <YourAppToken> 替换为你在服务端生成的 App Token
curl -X POST -H "Authorization: Bearer <YourAppToken> " "https://XXXX/XXXX/XXXX/messages/chatgroups/import" -d '{
"target": "username2",
"target": "1123376564212",
"type": "txt",
"body": {
"msg": "import message."
Expand All @@ -229,7 +229,7 @@ curl -X POST -H "Authorization: Bearer <YourAppToken> " "https://XXXX/XXXX/XXXX/
```shell
# 将 <YourAppToken> 替换为你在服务端生成的 App Token
curl -X POST -H "Authorization: Bearer <YourAppToken> " "https://XXXX/XXXX/XXXX/messages/chatgroups/import" -d '{
"target": "username2",
"target": "1123376564212",
"type": "img",
"body": {
"url": "<YourImageUrl>",
Expand Down
9 changes: 8 additions & 1 deletion docs/document/server-side/message_recall.md
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,14 @@ DELETE https://{host}/{org_name}/{app_name}/users/{username}/user_channel
```shell
# 将 <YourAppToken> 替换为你在服务端生成的 App Token

curl -X DELETE -H "Authorization: Bearer <YourAppToken>" "https://XXXX/XXXX/XXXX/users/u1/user_channel" -d '{"channel":"u2", "type":"chat","delete_roam": true}'
curl -L -X DELETE 'https://XXXX/XXXX/XXXX/users/u1/user_channel' \
-H 'Authorization: Bearer <YourAppToken>' \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-d '
{ "channel": "u2", "type": "chat", "delete_roam": true }
'
```

#### 响应示例
Expand Down

0 comments on commit 3ae6d8b

Please sign in to comment.