次の方法で共有


Chat - Create Chat Thread

チャット スレッドを作成します。

POST {endpoint}/chat/threads?api-version=2024-03-07

URI パラメーター

名前 / 必須 説明
endpoint
path True

string

Azure Communication リソースのエンドポイント。

api-version
query True

string

呼び出す API のバージョン。

要求ヘッダー

名前 必須 説明
Authorization True

string

ACS (Azure Communication Services) ユーザー アクセス トークン。

repeatability-request-id

string

指定した場合、クライアントは要求が繰り返し可能であることを指示します。つまり、クライアントは同じ Repeatability -Request-Id で要求を複数回行い、サーバーが要求を複数回実行せずに適切な応答を返すことができます。 Repeatability-Request-Id の値は、クライアントによって生成され、常にグローバルに一意の要求の識別子を表す不透明な文字列です。 バージョン 4 (ランダム) UUID を使用することをお勧めします。

要求本文

名前 必須 説明
topic True

string

チャット スレッド トピック。

participants

ChatParticipant[]

チャット スレッドに追加する参加者。

応答

名前 説明
201 Created

CreateChatThreadResult

スレッドが作成されると、Location ヘッダーには、新しく作成されたスレッドの URL が含まれます。

401 Unauthorized

CommunicationErrorResponse

不正。

403 Forbidden

CommunicationErrorResponse

禁じられた。

429 Too Many Requests

CommunicationErrorResponse

要求が多すぎます。

Other Status Codes

CommunicationErrorResponse

サービスは使用できません。

セキュリティ

Authorization

ACS (Azure Communication Services) ユーザー アクセス トークン。

型: apiKey
/: header

Create chat thread
Create chat thread with repeatability request id header

Create chat thread

要求のサンプル

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"
    }
  ]
}

応答のサンプル

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

要求のサンプル

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"
    }
  ]
}

応答のサンプル

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."
  }
}

定義

名前 説明
ChatParticipant

チャット スレッドの参加者。

ChatThreadProperties

チャット スレッド。

CreateChatThreadRequest

チャット スレッドを作成するための要求ペイロード。

CreateChatThreadResult

チャット スレッドの作成操作の結果。

ChatParticipant

チャット スレッドの参加者。

名前 説明
communicationIdentifier

CommunicationIdentifierModel

displayName

string

チャット参加者の表示名。

shareHistoryTime

string (date-time)

チャット履歴が参加者と共有される時間。 タイムスタンプは yyyy-MM-ddTHH:mm:ssZRFC3339 形式です。

ChatThreadProperties

チャット スレッド。

名前 説明
createdByCommunicationIdentifier

CommunicationIdentifierModel

createdOn

string (date-time)

チャット スレッドが作成されたときのタイムスタンプ。 タイムスタンプは yyyy-MM-ddTHH:mm:ssZRFC3339 形式です。

deletedOn

string (date-time)

チャット スレッドが削除されたときのタイムスタンプ。 タイムスタンプは yyyy-MM-ddTHH:mm:ssZRFC3339 形式です。

id

string

チャット スレッド ID。

topic

string

チャット スレッドのトピック。

CreateChatThreadRequest

チャット スレッドを作成するための要求ペイロード。

名前 説明
participants

ChatParticipant[]

チャット スレッドに追加する参加者。

topic

string

チャット スレッド トピック。

CreateChatThreadResult

チャット スレッドの作成操作の結果。

名前 説明
chatThread

ChatThreadProperties

チャット スレッド。

invalidParticipants

CommunicationError[]

チャット スレッドに追加できなかった参加者。