Chat - Create Chat Thread
Cria um thread de chat.
POST {endpoint}/chat/threads?api-version=2024-03-07
Parâmetros de URI
Nome | Em | Obrigatório | Tipo | Description |
---|---|---|---|---|
endpoint
|
path | True |
string |
O ponto de extremidade do recurso de Comunicação do Azure. |
api-version
|
query | True |
string |
Versão da API a ser invocada. |
Cabeçalho da solicitação
Nome | Obrigatório | Tipo | Description |
---|---|---|---|
Authorization | True |
string |
Um token de acesso de usuário do ACS (Serviços de Comunicação do Azure). |
repeatability-request-id |
string |
Se especificado, o cliente direciona que a solicitação seja repetível; ou seja, que o cliente pode fazer a solicitação várias vezes com a mesma RepetiçãoRequest-Id e obter uma resposta apropriada sem que o servidor execute a solicitação várias vezes. O valor doRequest-Id de Repetição é uma cadeia de caracteres opaca que representa um identificador globalmente exclusivo para todos os tempos gerado pelo cliente para a solicitação. É recomendável usar UUIDs da versão 4 (aleatória). |
Corpo da solicitação
Nome | Obrigatório | Tipo | Description |
---|---|---|---|
topic | True |
string |
O tópico do thread de chat. |
participants |
Participantes a serem adicionados ao thread de chat. |
Respostas
Nome | Tipo | Description |
---|---|---|
201 Created |
Thread criado, o cabeçalho |
|
401 Unauthorized |
Communication |
Desautorizado. |
403 Forbidden |
Communication |
Proibido. |
429 Too Many Requests |
Communication |
Muitas solicitações. |
Other Status Codes |
Communication |
Serviço indisponível. |
Segurança
Authorization
Um token de acesso de usuário do ACS (Serviços de Comunicação do Azure).
Tipo:
apiKey
Em:
header
Exemplos
Create chat thread |
Create chat thread with repeatability request id header |
Create chat thread
Solicitação de exemplo
POST https://contoso.westus.communications.azure.com/chat/threads?api-version=2024-03-07
{
"topic": "Lunch",
"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": "Jane"
},
{
"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": "Alex"
},
{
"communicationIdentifier": {
"rawId": "8:acs:8540c0de-899f-5cce-acb5-3ec493af3800_a34d2d65-d72f-4c48-a12c-2d5c9ac75a1a",
"communicationUser": {
"id": "8:acs:8540c0de-899f-5cce-acb5-3ec493af3800_a34d2d65-d72f-4c48-a12c-2d5c9ac75a1a"
}
},
"displayName": "Bob"
},
{
"communicationIdentifier": {
"rawId": "8:acs:8540c0de-899f-5cce-acb5-3ec493af3800_f6762773-e33a-4727-985f-50bd1d197c7b",
"communicationUser": {
"id": "8:acs:8540c0de-899f-5cce-acb5-3ec493af3800_f6762773-e33a-4727-985f-50bd1d197c7b"
}
},
"displayName": "Peter"
}
]
}
Resposta de exemplo
Location: https://contoso.westus.communications.azure.com/chat/threads/19%3Auni01_zbnh3nt2dfuffezc3sox7dog7wfhk6y5qe2rwlnfhlhdzirihdpq@thread.v2
{
"chatThread": {
"id": "19:uni01_zbnh3nt2dfuffezc3sox7dog7wfhk6y5qe2rwlnfhlhdzirihdpq@thread.v2",
"topic": "Lunch",
"createdOn": "2020-06-06T05:55:41.6460000Z",
"createdByCommunicationIdentifier": {
"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"
}
}
},
"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."
}
}
Create chat thread with repeatability request id header
Solicitação de exemplo
POST https://contoso.westus.communications.azure.com/chat/threads?api-version=2024-03-07
{
"topic": "Lunch",
"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": "Jane"
},
{
"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": "Alex"
},
{
"communicationIdentifier": {
"rawId": "8:acs:8540c0de-899f-5cce-acb5-3ec493af3800_a34d2d65-d72f-4c48-a12c-2d5c9ac75a1a",
"communicationUser": {
"id": "8:acs:8540c0de-899f-5cce-acb5-3ec493af3800_a34d2d65-d72f-4c48-a12c-2d5c9ac75a1a"
}
},
"displayName": "Bob"
},
{
"communicationIdentifier": {
"rawId": "8:acs:8540c0de-899f-5cce-acb5-3ec493af3800_f6762773-e33a-4727-985f-50bd1d197c7b",
"communicationUser": {
"id": "8:acs:8540c0de-899f-5cce-acb5-3ec493af3800_f6762773-e33a-4727-985f-50bd1d197c7b"
}
},
"displayName": "Peter"
}
]
}
Resposta de exemplo
Location: https://contoso.westus.communications.azure.com/chat/threads/19%3Auni01_zbnh3nt2dfuffezc3sox7dog7wfhk6y5qe2rwlnfhlhdzirihdpq@thread.v2
{
"chatThread": {
"id": "19:uni01_zbnh3nt2dfuffezc3sox7dog7wfhk6y5qe2rwlnfhlhdzirihdpq@thread.v2",
"topic": "Lunch",
"createdOn": "2020-06-06T05:55:41.6460000Z",
"createdByCommunicationIdentifier": {
"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"
}
}
},
"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."
}
}
Definições
Nome | Description |
---|---|
Chat |
Um participante do thread de chat. |
Chat |
Thread de chat. |
Create |
Solicite conteúdo para criar um thread de chat. |
Create |
Resultado da operação criar thread de chat. |
ChatParticipant
Um participante do thread de chat.
Nome | Tipo | Description |
---|---|---|
communicationIdentifier |
Communication |
|
displayName |
string |
Nome de exibição para o participante do chat. |
shareHistoryTime |
string (date-time) |
Hora da qual o histórico de chat é compartilhado com o participante. O carimbo de data/hora está no formato RFC3339: |
ChatThreadProperties
Thread de chat.
Nome | Tipo | Description |
---|---|---|
createdByCommunicationIdentifier |
Communication |
|
createdOn |
string (date-time) |
O carimbo de data/hora quando o thread de chat foi criado. O carimbo de data/hora está no formato RFC3339: |
deletedOn |
string (date-time) |
O carimbo de data/hora quando o thread de chat foi excluído. O carimbo de data/hora está no formato RFC3339: |
id |
string |
ID do thread de chat. |
topic |
string |
Tópico do thread de chat. |
CreateChatThreadRequest
Solicite conteúdo para criar um thread de chat.
Nome | Tipo | Description |
---|---|---|
participants |
Participantes a serem adicionados ao thread de chat. |
|
topic |
string |
O tópico do thread de chat. |
CreateChatThreadResult
Resultado da operação criar thread de chat.
Nome | Tipo | Description |
---|---|---|
chatThread |
Thread de chat. |
|
invalidParticipants |
Communication |
Os participantes que não foram adicionados ao thread de chat. |