共用方式為


Opt Outs - Remove

從選擇退出清單中刪除電話號碼。

POST {endpoint}/sms/optouts:remove?api-version=2026-01-23

URI 參數

名稱 位於 必要 類型 Description
endpoint
path True

string (url)

通訊資源,例如 https://my-resource.communication.azure.com

api-version
query True

string

要叫用的 API 版本。

要求本文

名稱 必要 類型 Description
from True

string

minLength: 1

發件人的識別碼(通常是 E.164 格式的電話號碼),由已驗證的帳戶擁有。

recipients True

OptOutRecipient[]

單一選擇退出收件者號碼。

回應

名稱 類型 Description
200 OK

OptOutResponse

成功

400 Bad Request

BadRequestErrorResponse

錯誤的請求

401 Unauthorized

StandardErrorResponse

未經授權

範例

Opt In

範例要求

POST {endpoint}/sms/optouts:remove?api-version=2026-01-23

{
  "from": "+18001234567",
  "recipients": [
    {
      "to": "+15555555551"
    },
    {
      "to": "+123"
    },
    {
      "to": "+15555555553"
    }
  ]
}

範例回覆

{
  "value": [
    {
      "to": "+15555555551",
      "httpStatusCode": 200
    },
    {
      "to": "+123",
      "httpStatusCode": 400,
      "errorMessage": "Invalid recipient phone number format"
    },
    {
      "to": "+15555555553",
      "httpStatusCode": 500,
      "errorMessage": "Internal Server Error"
    }
  ]
}
{
  "error": {
    "code": "InvalidApiVersion",
    "message": "The HTTP resource that matches the request URI 'https://global.sms.int.communication.microsoft.com/sms/optouts:remove' does not support the API version '2024-12-10w-preview'.",
    "innerError": null
  }
}
{
  "error": {
    "code": "Unauthorized",
    "message": ""
  }
}

定義

名稱 Description
BadRequestErrorResponse

錯誤要求錯誤回應,可以同時代表驗證錯誤和標準 API 錯誤。

ErrorDetail

錯誤詳細資料。

OptOutRecipient

單一選擇退出收件者號碼。

OptOutRequest

選擇退出請求。

OptOutResponse

選擇退出要求的回應。 驗證回應中傳回的專案,以查看哪些收件者已成功從選擇退出清單中新增或移除。

OptOutResponseItem
StandardErrorResponse

標準錯誤回應格式。

BadRequestErrorResponse

錯誤要求錯誤回應,可以同時代表驗證錯誤和標準 API 錯誤。

名稱 類型 Description
error

ErrorDetail

錯誤詳細資料 (適用於標準 API 錯誤)。

errors

object

欄位特定驗證錯誤的字典 (適用於驗證錯誤)。

status

integer (int32)

HTTP 狀態碼 (用於驗證錯誤)。

title

string

問題類型的簡短、人類可讀的摘要(針對驗證錯誤)。

traceId

string

要求的追蹤識別碼 (驗證錯誤)。

type

string

識別問題類型的 URI 參照 (針對驗證錯誤)。

ErrorDetail

錯誤詳細資料。

名稱 類型 Description
code

string

錯誤碼。

innerError

object

其他錯誤詳細資料。

message

string

錯誤訊息。

OptOutRecipient

單一選擇退出收件者號碼。

名稱 類型 Description
to

string

minLength: 1

收件人的電話號碼(E.164 格式)。

OptOutRequest

選擇退出請求。

名稱 類型 Description
from

string

minLength: 1

發件人的識別碼(通常是 E.164 格式的電話號碼),由已驗證的帳戶擁有。

recipients

OptOutRecipient[]

單一選擇退出收件者號碼。

OptOutResponse

選擇退出要求的回應。 驗證回應中傳回的專案,以查看哪些收件者已成功從選擇退出清單中新增或移除。

名稱 類型 Description
value

OptOutResponseItem[]

OptOutResponseItem

名稱 類型 Description
errorMessage

string

發生 4xx/5xx 錯誤時的可選錯誤訊息。

httpStatusCode

integer (int32)

isOptedOut

boolean

選擇性旗標,指定號碼是否已選擇退出接收訊息

to

string

minLength: 1

收件者電話號碼(E.164 格式)。

StandardErrorResponse

標準錯誤回應格式。

名稱 類型 Description
error

ErrorDetail

錯誤詳細資料。