频道与用户管理
构建时从公开 REST 接口定义的 `channels` 标签生成:方法、路径、参数、请求体、响应与 curl。
分组概览
本页由公开 REST 接口定义在构建时生成:标签 channels,共 7 个操作(全量 189 个)。鉴权、信封与分页约定见 REST API 总览.
| 方法 | 路径 | 摘要 |
|---|---|---|
GET | /v1/channels | List channels |
GET | /v1/channels/{channelName}/users | List users in a channel |
GET | /v1/channels/{channelName}/users/{uid} | Get one user |
DELETE | /v1/channels/{channelName}/users/{uid} | Kick a user |
POST | /v1/channels/{channelName}/users/{uid}/mute | Server-side mute |
POST | /v1/channels/{channelName}/users/{uid}/role | Change role (host/audience) |
POST | /v1/channels/{channelName}/users/{uid}/unmute | Lift a server-side mute |
操作详情
GET /v1/channels
List channels
鉴权:项目凭证(customerId:customerSecret 的 Base64)
参数
| 名称 | 位置 | 必填 | 类型 | 说明 |
|---|---|---|---|---|
page_no | query | integer | >= 0,默认 0 | |
page_size | query | integer | 1..500,默认 100 |
响应
| 状态码 | 说明 / schema |
|---|---|
200 | channels — object{ total, pageNo, pageSize, channels } |
401 | Missing/invalid credentials — Error |
调用示例
curl -s -X GET "$NIMEET_API_BASE/v1/channels?page_no=0&page_size=100" \
-H "Authorization: Basic $NIMEET_CUSTOMER_BASIC"GET /v1/channels/{channelName}/users
List users in a channel
鉴权:项目凭证(customerId:customerSecret 的 Base64)
参数
| 名称 | 位置 | 必填 | 类型 | 说明 |
|---|---|---|---|---|
channelName | path | 是 | string | 长度 0..128 |
响应
| 状态码 | 说明 / schema |
|---|---|
200 | users — object{ channel, users } |
404 | Resource not found — Error |
调用示例
curl -s -X GET "$NIMEET_API_BASE/v1/channels/weekly-sync/users" \
-H "Authorization: Basic $NIMEET_CUSTOMER_BASIC"GET /v1/channels/{channelName}/users/{uid}
Get one user
鉴权:项目凭证(customerId:customerSecret 的 Base64)
参数
| 名称 | 位置 | 必填 | 类型 | 说明 |
|---|---|---|---|---|
channelName | path | 是 | string | 长度 0..128 |
uid | path | 是 | integer | 1..2147483647 |
响应
| 状态码 | 说明 / schema |
|---|---|
200 | user — UserView |
404 | Resource not found — Error |
调用示例
curl -s -X GET "$NIMEET_API_BASE/v1/channels/weekly-sync/users/10001" \
-H "Authorization: Basic $NIMEET_CUSTOMER_BASIC"DELETE /v1/channels/{channelName}/users/{uid}
Kick a user
Removes the participant from the media plane, emits a leave callback with Agora reason 3, and creates a join_channel ban rule for the given duration (0 = kick only).
鉴权:项目凭证(customerId:customerSecret 的 Base64)
参数
| 名称 | 位置 | 必填 | 类型 | 说明 |
|---|---|---|---|---|
channelName | path | 是 | string | 长度 0..128 |
uid | path | 是 | integer | 1..2147483647 |
请求体
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
durationSeconds | integer | 0..86430 | |
reason | string |
{
"durationSeconds": 600,
"reason": "docs-example"
}响应
| 状态码 | 说明 / schema |
|---|---|
200 | the kick result and the ban rule it created — object{ kicked, uid, banRuleId, expireAt } |
404 | Resource not found — Error |
调用示例
curl -s -X DELETE "$NIMEET_API_BASE/v1/channels/weekly-sync/users/10001" \
-H "Authorization: Basic $NIMEET_CUSTOMER_BASIC" \
-H "Content-Type: application/json" \
-d '{"durationSeconds":600,"reason":"docs-example"}'POST /v1/channels/{channelName}/users/{uid}/mute
Server-side mute
鉴权:项目凭证(customerId:customerSecret 的 Base64)
参数
| 名称 | 位置 | 必填 | 类型 | 说明 |
|---|---|---|---|---|
channelName | path | 是 | string | 长度 0..128 |
uid | path | 是 | integer | 1..2147483647 |
请求体
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
kind | enum(audio | video | all) | 默认 "all" | |
banPublish | boolean | ||
durationSeconds | integer |
{
"kind": "audio",
"banPublish": true,
"durationSeconds": 600
}响应
| 状态码 | 说明 / schema |
|---|---|
200 | the mute result, the tracks muted and the ban rules created — object{ muted, uid, kind, mutedTracks, banRuleIds } |
404 | Resource not found — Error |
调用示例
curl -s -X POST "$NIMEET_API_BASE/v1/channels/weekly-sync/users/10001/mute" \
-H "Authorization: Basic $NIMEET_CUSTOMER_BASIC" \
-H "Content-Type: application/json" \
-d '{"kind":"audio","banPublish":true,"durationSeconds":600}'POST /v1/channels/{channelName}/users/{uid}/role
Change role (host/audience)
Updates media permissions and emits role_to_broadcaster (111) or role_to_audience (112).
鉴权:项目凭证(customerId:customerSecret 的 Base64)
参数
| 名称 | 位置 | 必填 | 类型 | 说明 |
|---|---|---|---|---|
channelName | path | 是 | string | 长度 0..128 |
uid | path | 是 | integer | 1..2147483647 |
请求体
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
role | enum(host | audience) | 是 |
{
"role": "audience"
}响应
| 状态码 | 说明 / schema |
|---|---|
200 | the user with its new role — object{ uid, role } |
404 | Resource not found — Error |
调用示例
curl -s -X POST "$NIMEET_API_BASE/v1/channels/weekly-sync/users/10001/role" \
-H "Authorization: Basic $NIMEET_CUSTOMER_BASIC" \
-H "Content-Type: application/json" \
-d '{"role":"audience"}'POST /v1/channels/{channelName}/users/{uid}/unmute
Lift a server-side mute
鉴权:项目凭证(customerId:customerSecret 的 Base64)
参数
| 名称 | 位置 | 必填 | 类型 | 说明 |
|---|---|---|---|---|
channelName | path | 是 | string | 长度 0..128 |
uid | path | 是 | integer | 1..2147483647 |
请求体
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
kind | enum(audio | video | all) | 默认 "all" |
{
"kind": "audio"
}响应
| 状态码 | 说明 / schema |
|---|---|
200 | the unmute result and the tracks that were restored — object{ unmuted, uid, kind, unmutedTracks } |
调用示例
curl -s -X POST "$NIMEET_API_BASE/v1/channels/weekly-sync/users/10001/unmute" \
-H "Authorization: Basic $NIMEET_CUSTOMER_BASIC" \
-H "Content-Type: application/json" \
-d '{"kind":"audio"}'本分组用到的 Schema
ChannelSummary — object{ channelName, userCount, profile, createdAt }
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
channelName | string | ||
userCount | integer | ||
profile | enum(communication | live) | ||
createdAt | string | null | format date-time |
Error — object{ code, message, reason, sdkCode, details }
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
code | string | 是 | stable machine code, see errors.json |
message | string | 是 | |
reason | string | ||
sdkCode | integer | Agora-aligned client error number | |
details | object |
UserView — object
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
uid | integer | ||
userId | string | null | ||
role | enum(host | audience) | ||
platform | integer | ||
joinedAt | string | format date-time | |
audioMuted | boolean | ||
videoMuted | boolean | ||
publishing | object{ audio, video, screen } |