Skip to content

Commit

Permalink
docs: update user and group management API documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
mo3et committed Sep 14, 2024
1 parent e0f27b1 commit e820cb3
Show file tree
Hide file tree
Showing 7 changed files with 364 additions and 3 deletions.
2 changes: 1 addition & 1 deletion docs/restapi/apis/userManagement/updateUserInfoEx.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ hide_title: true
</center>

### 简要描述
- 修改用户的头像、昵称。
- 修改用户的头像、昵称。(如果使用此接口,请使用 **[更新用户信息Ex之前的回调](docs/restapi/webhooks/user/updateUserInfoExBefore.mdx)****[更新用户信息Ex之后的回调](docs/restapi/webhooks/group/updateUserInfoExAfter.mdx)**。)
### 请求方式
- `post`
### 请求URL
Expand Down
90 changes: 90 additions & 0 deletions docs/restapi/webhooks/user/updateUserInfoExAfter.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
---
title: 更新用户信息Ex之后的回调
hide_title: true
---

# 更新用户信息Ex之后的回调

## 功能说明
App 业务服务端可以通过该回调获取用户更新个人信息后的结果,App 后台可以据此进行数据同步等操作。

## 注意事项
- 为启用回调,必须配置回调 URL,并开启本条回调协议对应的开关。配置方法详见 [回调说明](../introduction) 文档。
- 回调的方向是 OpenIMServer 向 App 后台发起 HTTP/HTTPS POST 请求。
- APP 业务服务端需在超时时间内响应此请求。

## 可能触发该回调的场景
- App 用户通过客户端更新个人信息。
- App 管理员通过 REST API 更新用户信息。

## 回调发生时机
- OpenIMServer 处理完用户信息更新请求之后。

## 接口说明

### 请求 URL 示例
以下示例中 App 配置的回调 URL 为 `http://www.example.com/callbackCommand?contenttype=json`
```plaintext
http://www.example.com/callbackAfterUpdateUserInfoCommand?contenttype=json
```

### 请求参数说明

| 参数 | 说明 |
|-----------------|-----------------------------------------------|
| http | 请求协议为 HTTP,请求方式为 POST |
| www.example.com | configy.yaml 中的 callback.url 字段,域名或主机名 |
| CallbackCommand | 此处为:callbackAfterUpdateUserInfoCommand |
| contenttype | 固定值为:JSON |

### Header
| header名 | 示例值 | 选填 | 类型 | 说明 |
|:------------|:--------------|:----|--------|---------------------|
| operationID | 1646445464564 | 必填 | string | operationID用于全局链路追踪 |

### 请求包示例
```json
{
"callbackCommand": "callbackAfterUpdateUserInfoCommand",
"userID": "user123",
"nickName": "John Doe",
"faceURL": "http://example.com/path/to/face/image.png",
"ex": "Extra data"
}
```

### 请求包字段说明

| 字段 | 类型 | 描述 |
|----------------|---------|---------------------------------|
| callbackCommand | string | 回调命令,这里是更新用户信息之后的回调 |
| userID | string | 用户的唯一标识符 |
| nickName | StringValue | 用户的昵称 |
| faceURL | StringValue | 用户头像的URL |
| ex | StringValue | 额外的数据字段 |

## 应答包示例
App 后台同步数据后,发送回调应答包。

```json
{
"actionCode": 0,
"errCode": 0,
"errMsg": "Success",
"errDlt": "",
"nextCode": 1
}

```



## 应答包字段说明

| 字段 || 说明 |
|-------------|------------------------------|------------------------------------------|
| actionCode | 0 | 表示业务系统的回调是否正确执行。`0`表示操作成功。 |
| errCode | 0 | 表示自定义错误码,此处填0代表忽略回调结果。|
| errMsg | "An error message" | 自定义错误码对应的简单错误信息。|
| errDlt | "Detailed error information" | 自定义错误码对应的详细错误信息。|
| nextCode | 1 | 下一步执行指令,`1`表示拒绝继续执行,actionCode等于`0`时设置。|
97 changes: 97 additions & 0 deletions docs/restapi/webhooks/user/updateUserInfoExBefore.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
---
title: 更新用户信息Ex之前的回调
hide_title: true
---

# 更新用户信息Ex之前的回调

## 功能说明
App 业务服务端可以通过该回调获取用户更新个人信息的请求,或对请求做修改和干预。

## 注意事项
- 为启用回调,必须配置回调 URL,并开启本条回调协议对应的开关。配置方法详见 [回调说明](../introduction) 文档。
- 回调的方向是 OpenIMServer 向 App 后台发起 HTTP/HTTPS POST 请求。
- APP 业务服务端需在超时时间内响应此请求。

## 可能触发该回调的场景
- App 用户通过客户端更新个人信息。
- App 管理员通过 REST API 更新用户信息。:


## 回调发生时机
- OpenIMServer 准备更新用户信息之前。

## 接口说明

### 请求 URL 示例
以下示例中 App 配置的回调 URL 为 `http://www.example.com/callbackCommand?contenttype=json`
```plaintext
http://www.example.com/callbackBeforeUpdateUserInfoExCommand?contenttype=json
```

### 请求参数说明

| 参数 | 说明 |
|-----------------|-----------------------------------------------|
| http | 请求协议为 HTTP,请求方式为 POST |
| www.example.com | configy.yaml 中的 callback.url 字段,域名或主机名 |
| CallbackCommand | callbackBeforeUpdateUserInfoExCommand |
| contenttype | 固定值为:JSON |

### Header
| header名 | 示例值 | 选填 | 类型 | 说明 |
|:------------|:--------------|:----|--------|---------------------|
| operationID | 1646445464564 | 必填 | string | operationID用于全局链路追踪 |


### 请求包示例
```json
{
"callbackCommand": "callbackBeforeUpdateUserInfoExCommand",
"userID": "user123",
"nickName": "John Doe",
"faceURL": "http://example.com/path/to/face/image.png",
"ex": "Extra data"
}
```

### 请求包字段说明

| 字段 | 类型 | 描述 |
|----------------|---------|---------------------------------|
| callbackCommand | string | 回调命令,这里是更新用户信息之前的回调 |
| userID | string | 用户的唯一标识符 |
| nickName | StringValue | 用户的昵称 |
| faceURL | StringValue | 用户头像的URL |
| ex | StringValue | 额外的数据字段 |

## 应答包示例

### 允许更新
允许用户更新信息。

```json
{
"actionCode": 0,
"errCode": 0,
"errMsg": "Success",
"errDlt": "",
"nextCode": "0",
"nickName": "John Doe Updated",
"faceURL": "http://example.com/new/face/image.png",
"ex": "Updated extra data"
}
```

## 应答包字段说明

| 字段 || 说明 |
|------------|------------------------------|-------------------------------------------------------------------|
| actionCode | 0 | 表示业务系统的回调是否正确执行。`0`表示操作成功。 |
| errCode | 5001 | 表示自定义错误码,范围在5000-9999之间。在 actionCode 不等于0时设置;在 nextCode 等于1时设置。|
| errMsg | "An error message" | 自定义错误码对应的简单错误信息。 |
| errDlt | "Detailed error information" | 自定义错误码对应的详细错误信息。 |
| nextCode | 1 | 下一步执行指令,`1`表示拒绝继续执行,actionCode 等于`0`时设置。 |
| nickName | StringValue | 用户的昵称 |
| faceURL | StringValue | 用户头像的URL |
| ex | StringValue | 额外的数据字段 |
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ hide_title: true

### Brief description

- Modify group information. If you use this interface, (please use [setGroupInfoEXBefore](/restapi/webhooks/group/setGroupInfoEXBefore) and [setGroupInfoEXAfter](/restapi/webhooks/group/setGroupInfoEXAfter)).
- Modify group information. (If you use this interface, please use [setGroupInfoEXBefore](/restapi/webhooks/group/setGroupInfoEXBefore) and [setGroupInfoEXAfter](/restapi/webhooks/group/setGroupInfoEXAfter)).

### Request method
- `post`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ hide_title: true
</center>

### Brief Description
- Modify user's avatar and nickname.
- Modify user's avatar and nickname. (If you use this interface, please use [updateUserInfoExBefore](/restapi/webhooks/user/updateUserInfoExBefore) and [updateUserInfoExAfter](/restapi/webhooks/user/updateUserInfoExAfter)).

### Request Method
- `POST`
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
# Callback After Updating User Information Ex

## Function Description
The App business server can use this callback to get the results after a user updates their personal information. The backend can use this information for data synchronization and other operations.

## Precautions
- To enable the callback, it is necessary to configure the callback URL and activate the corresponding switch for this callback protocol. Configuration methods can be found in the [Callback Explanation](../introduction) document.
- The direction of the callback is an HTTP/HTTPS POST request initiated by OpenIMServer to the App backend.
- After receiving the callback request, the App business server must verify whether the command parameter in the request URL is its SDKNAME parameter.
- The APP business server must respond to this request within the timeout period.

## Scenarios That May Trigger This Callback
- App users update their personal information through the client.
- App administrators update user information through the REST API.

## Timing of the Callback
- After OpenIMServer has processed the user information update request.

## Interface Description

### Request URL Example
In the following example, the callback URL configured by the App is `https://callbackurl`.
```plaintext
https://callbackurl?command=$CallbackCommand&contenttype=json
```

### Request Parameter Description

| Parameter | Description |
|----------------------|------------------------------------------------------|
| https | Request protocol is HTTPS, method is POST |
| https://callbackurl | Callback URL |
| CallbackCommand | Fixed value: callbackAfterUpdateUserInfoCommand |
| contenttype | Fixed value: JSON |

### Header
| Header Name | Example Value | Mandatory | Type | Description |
|-------------|---------------|-----------|--------|-------------------------------------|
| operationID | 1646445464564 | Required | string | operationID for global link tracing |

### Request Packet Example
```json
{
"callbackCommand": "callbackAfterUpdateUserInfoCommand",
"userID": "user123",
"nickName": "John Doe",
"faceURL": "http://example.com/path/to/face/image.png",
"ex": "Extra data"
}
```

### Request Packet Field Explanation

| Field | Type | Description |
|-----------------|---------|-------------------------------------------|
| callbackCommand | string | Callback command, here for after updating user information |
| userID | string | The unique identifier of the user |
| nickName | string | The nickname of the user |
| faceURL | string | URL of the user's avatar |
| ex | string | Additional data fields |

## Response Packet Example
The App backend sends a callback response packet after syncing data.

```json
{
"actionCode": 0,
"errCode": 0,
"errMsg": "Success",
"errDlt": "",
"nextCode": 1
}
```

## Response Packet Field Explanation

| Field | Value | Description |
|------------|--------|----------------------------------------------------------|
| actionCode | 0 | Indicates if the business system's callback was executed correctly. `0` means the operation was successful. |
| errCode | 0 | Custom error code, here 0 means ignore the callback result. |
| errMsg | "An error message" | Simple error message corresponding to the custom error code. |
| errDlt | "Detailed error information" | Detailed error information corresponding to the custom error code. |
| nextCode | 1 | Next step instruction, `1` means to refuse to continue executing, set when actionCode is `0`. |
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
# Callback Before Updating User Information Ex

## Function Description
The App business server can use this callback to receive requests from users to update their personal information. Additionally, the business server can modify and intervene in the request.

## Precautions
- To enable the callback, it is necessary to configure the callback URL and activate the corresponding switch for this callback protocol. Configuration methods can be found in the [Callback Explanation](../introduction) document.
- The direction of the callback is an HTTP/HTTPS POST request initiated by OpenIMServer to the App backend.
- After receiving the callback request, the App business server must verify whether the command parameter in the request URL is its SDKNAME parameter.
- The APP business server must respond to this request within the timeout period.

## Scenarios That May Trigger This Callback
- App users update their personal information through the client.
- App administrators update user information through the REST API.

## Timing of the Callback
- Before OpenIMServer prepares to update user information.

## Interface Description

### Request URL Example
In the following example, the callback URL configured by the App is `https://callbackurl`.
```plaintext
https://callbackurl?command=$CallbackCommand&contenttype=json
```

### Request Parameter Description

| Parameter | Description |
|----------------------|------------------------------------------------------|
| https | Request protocol is HTTPS, method is POST |
| https://callbackurl | Callback URL |
| CallbackCommand | Fixed value: callbackBeforeUpdateUserInfoExCommand |
| contenttype | Fixed value: JSON |

### Header
| Header Name | Example Value | Mandatory | Type | Description |
|-------------|---------------|-----------|--------|-------------------------------------|
| operationID | 1646445464564 | Required | string | operationID for global link tracing |

### Request Packet Example
```json
{
"callbackCommand": "callbackBeforeUpdateUserInfoExCommand",
"userID": "user123",
"nickName": "John Doe",
"faceURL": "http://example.com/path/to/face/image.png",
"ex": "Extra data"
}
```

### Request Packet Field Explanation

| Field | Type | Description |
|-----------------|---------|-------------------------------------------|
| callbackCommand | string | Callback command, here for before updating user information |
| userID | string | The unique identifier of the user |
| nickName | StringValue | The nickname of the user |
| faceURL | StringValue | URL of the user's avatar |
| ex | StringValue | Additional data fields |

## Response Packet Example

### Allow Update
Allows the user to update their information.

```json
{
"actionCode": 0,
"errCode": 0,
"errMsg": "Success",
"errDlt": "",
"nextCode": "0",
"nickName": "John Doe Updated",
"faceURL": "http://example.com/new/face/image.png",
"ex": "Updated extra data"
}
```

## Response Packet Field Explanation

| Field | Value | Description |
|------------|--------|----------------------------------------------------------|
| actionCode | 0 | Indicates if the business system's callback was executed correctly. `0` means the operation was successful. |
| errCode | 5001 | Custom error code, ranging between 5000-9999. Set when actionCode is not 0; set when nextCode is not 1. |
| errMsg | "An error message" | Simple error message corresponding to the custom error code. |
| errDlt | "Detailed error information" | Detailed error information corresponding to the custom error code. |
| nextCode | 1 | Next step instruction, `1` means to refuse to continue executing, set when actionCode is `0`. |
| nickName | StringValue | The nickname of the user. |
| faceURL | StringValue | URL of the user's updated avatar. |
| ex | StringValue | Updated additional data fields. |

0 comments on commit e820cb3

Please sign in to comment.