Chat - Create Chat Thread
Crea un subproceso de chat.
POST {endpoint}/chat/threads?api-version=2024-03-07
Parámetros de identificador URI
Nombre | En | Requerido | Tipo | Description |
---|---|---|---|---|
endpoint
|
path | True |
string |
Punto de conexión del recurso de Comunicación de Azure. |
api-version
|
query | True |
string |
Versión de la API que se va a invocar. |
Encabezado de la solicitud
Nombre | Requerido | Tipo | Description |
---|---|---|---|
Authorization | True |
string |
Un token de acceso de usuario de ACS (Azure Communication Services). |
repeatability-request-id |
string |
Si se especifica, el cliente dirige que se puede repetir la solicitud; es decir, que el cliente puede realizar la solicitud varias veces con la misma repetibilidad:Request-Id y obtener una respuesta adecuada sin que el servidor ejecute la solicitud varias veces. El valor de repeatability-Request-Id es una cadena opaca que representa un identificador globalmente único para todo el tiempo generado por el cliente para la solicitud. Se recomienda usar LOS UUID de la versión 4 (aleatorios). |
Cuerpo de la solicitud
Nombre | Requerido | Tipo | Description |
---|---|---|---|
topic | True |
string |
El tema del subproceso de chat. |
participants |
Participantes que se agregarán al subproceso de chat. |
Respuestas
Nombre | Tipo | Description |
---|---|---|
201 Created |
Subproceso creado, el encabezado |
|
401 Unauthorized |
Communication |
Desautorizado. |
403 Forbidden |
Communication |
Prohibido. |
429 Too Many Requests |
Communication |
Demasiadas solicitudes. |
Other Status Codes |
Communication |
Servicio no disponible. |
Seguridad
Authorization
Un token de acceso de usuario de ACS (Azure Communication Services).
Tipo:
apiKey
En:
header
Ejemplos
Create chat thread |
Create chat thread with repeatability request id header |
Create chat thread
Solicitud de ejemplo
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"
}
]
}
Respuesta de muestra
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
Solicitud de ejemplo
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"
}
]
}
Respuesta de muestra
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."
}
}
Definiciones
Nombre | Description |
---|---|
Chat |
Participante del subproceso de chat. |
Chat |
Subproceso de chat. |
Create |
Solicitar carga para crear un subproceso de chat. |
Create |
Resultado de la operación de creación de subprocesos de chat. |
ChatParticipant
Participante del subproceso de chat.
Nombre | Tipo | Description |
---|---|---|
communicationIdentifier |
Communication |
|
displayName |
string |
Nombre para mostrar del participante del chat. |
shareHistoryTime |
string (date-time) |
Hora desde la que se comparte el historial de chat con el participante. La marca de tiempo está en formato RFC3339: |
ChatThreadProperties
Subproceso de chat.
Nombre | Tipo | Description |
---|---|---|
createdByCommunicationIdentifier |
Communication |
|
createdOn |
string (date-time) |
Marca de tiempo cuando se creó el subproceso de chat. La marca de tiempo está en formato RFC3339: |
deletedOn |
string (date-time) |
Marca de tiempo cuando se eliminó el subproceso de chat. La marca de tiempo está en formato RFC3339: |
id |
string |
Identificador de subproceso de chat. |
topic |
string |
Tema del subproceso de chat. |
CreateChatThreadRequest
Solicitar carga para crear un subproceso de chat.
Nombre | Tipo | Description |
---|---|---|
participants |
Participantes que se agregarán al subproceso de chat. |
|
topic |
string |
El tema del subproceso de chat. |
CreateChatThreadResult
Resultado de la operación de creación de subprocesos de chat.
Nombre | Tipo | Description |
---|---|---|
chatThread |
Subproceso de chat. |
|
invalidParticipants |
Communication |
Los participantes que no se pudieron agregar al subproceso de chat. |