Chat Thread - Add Chat Participants
将线程参与者添加到线程。 如果参与者已存在,则不会发生任何更改。
POST {endpoint}/chat/threads/{chatThreadId}/participants/:add?api-version=2025-03-15
URI 参数
| 名称 | 在 | 必需 | 类型 | 说明 |
|---|---|---|---|---|
|
chat
|
path | True |
string |
要向其添加参与者的线程的 ID。 |
|
endpoint
|
path | True |
string |
Azure 通信资源的终结点。 |
|
api-version
|
query | True |
string |
要调用的 API 版本。 |
请求头
| 名称 | 必需 | 类型 | 说明 |
|---|---|---|---|
| Authorization | True |
string |
ACS(Azure 通信服务)用户访问令牌。 |
请求正文
| 名称 | 必需 | 类型 | 说明 |
|---|---|---|---|
| participants | True |
要添加到聊天线程的参与者。 |
响应
| 名称 | 类型 | 说明 |
|---|---|---|
| 201 Created |
已成功添加参与者。 |
|
| 401 Unauthorized |
Communication |
未授权。 |
| 403 Forbidden |
Communication |
已禁止。 |
| 429 Too Many Requests |
Communication |
请求过多。 |
| Other Status Codes |
Communication |
服务不可用。 |
安全性
Authorization
ACS(Azure 通信服务)用户访问令牌。
类型:
apiKey
在:
header
示例
Add participants
示例请求
POST https://contoso.westus.communications.azure.com/chat/threads/19:f2167429acf6482880c6b7790a9086c1@thread.v2/participants/:add?api-version=2025-03-15
{
"participants": [
{
"communicationIdentifier": {
"rawId": "8:acs:8540c0de-899f-5cce-acb5-3ec493af3800_c94ff260-162d-46d6-94fd-e79f4d213715",
"communicationUser": {
"id": "8:acs:8540c0de-899f-5cce-acb5-3ec493af3800_c94ff260-162d-46d6-94fd-e79f4d213715"
}
},
"displayName": "Alex",
"shareHistoryTime": "2020-06-06T05:55:41Z"
},
{
"communicationIdentifier": {
"rawId": "8:acs:8540c0de-899f-5cce-acb5-3ec493af3800_0e59221d-0c1d-46ae-9544-c963ce56c10b",
"communicationUser": {
"id": "8:acs:8540c0de-899f-5cce-acb5-3ec493af3800_0e59221d-0c1d-46ae-9544-c963ce56c10b"
}
},
"displayName": "Peter",
"shareHistoryTime": "2020-06-06T05:55:41Z"
},
{
"communicationIdentifier": {
"rawId": "8:acs:8540c0de-899f-5cce-acb5-3ec493af3800_f13a9208-0bb8-45c0-916c-f3ed922728ce",
"communicationUser": {
"id": "8:acs:8540c0de-899f-5cce-acb5-3ec493af3800_f13a9208-0bb8-45c0-916c-f3ed922728ce"
}
},
"displayName": "Rama",
"shareHistoryTime": "2020-06-06T05:55:41Z"
}
]
}
示例响应
{
"invalidParticipants": [
{
"target": "8:acs:8540c0de-899f-5cce-acb5-3ec493af3800_a34d2d65-d72f-4c48-a12c-2d5c9ac75a1a",
"code": "403",
"message": "Permissions check failed"
},
{
"target": "8:acs:8540c0de-899f-5cce-acb5-3ec493af3800_f6762773-e33a-4727-985f-50bd1d197c7b",
"code": "404",
"message": "Not found"
}
]
}
{
"error": {
"code": "Unauthorized",
"message": "Request is not authorized."
}
}
{
"error": {
"code": "Forbidden",
"message": "User is not allowed to perform specified action."
}
}
{
"error": {
"code": "TooManyRequests",
"message": "Rate limit exceeded."
}
}
{
"error": {
"code": "ServiceUnavailable",
"message": "The server is currently unable to handle the request."
}
}
定义
| 名称 | 说明 |
|---|---|
|
Add |
要添加到线程中的参与者。 |
|
Add |
添加聊天参与者操作的结果。 |
|
Chat |
聊天线程的参与者。 |
AddChatParticipantsRequest
要添加到线程中的参与者。
| 名称 | 类型 | 说明 |
|---|---|---|
| participants |
要添加到聊天线程的参与者。 |
AddChatParticipantsResult
添加聊天参与者操作的结果。
| 名称 | 类型 | 说明 |
|---|---|---|
| invalidParticipants |
Communication |
未能添加到聊天线程的参与者。 |
ChatParticipant
聊天线程的参与者。
| 名称 | 类型 | 说明 |
|---|---|---|
| communicationIdentifier |
Communication |
|
| displayName |
string |
聊天参与者的显示名称。 |
| metadata |
object |
聊天参与者的上下文元数据。 元数据由名称/值对组成。 所有元数据对的总大小最多可为 1KB。 |
| shareHistoryTime |
string (date-time) |
聊天历史记录与参与者共享的时间。 时间戳采用RFC3339格式: |