你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn。
Phone Numbers - Search Available Phone Numbers
搜索要购买的可用电话号码。
POST {endpoint}/availablePhoneNumbers/countries/{countryCode}/:search?api-version=2022-12-01
URI 参数
名称 | 在 | 必需 | 类型 | 说明 |
---|---|---|---|---|
country
|
path | True |
string |
ISO 3166-2 国家/地区代码,例如美国。 |
endpoint
|
path | True |
string url |
|
api-version
|
query | True |
string |
要调用的 API 版本 |
请求正文
名称 | 必需 | 类型 | 说明 |
---|---|---|---|
assignmentType | True |
要搜索的电话号码的分配类型。 可将电话号码分配给人员或应用程序。 |
|
capabilities | True |
电话号码的功能。 |
|
phoneNumberType | True |
要搜索的电话号码类型,例如地理或 tollFree。 |
|
areaCode |
string |
所需电话号码的区号,例如 425。 |
|
quantity |
integer |
所需电话号码的数量。 默认值为 1。 |
响应
名称 | 类型 | 说明 |
---|---|---|
202 Accepted |
该服务已接受请求,稍后将开始处理。 它将立即返回“Accepted”,并包含“Operation-Location”和“Location”标头。 客户端应使用“Operation-Location”标头中指定的 URL 进一步查询操作状态。 操作使用“位置”标头中指定的 URL 成功完成查询最终结果时。 标头
|
|
Other Status Codes |
失败 |
示例
Search for phone numbers
示例请求
POST https://resourcename.communication.azure.com//availablePhoneNumbers/countries/US/:search?api-version=2022-12-01
{
"phoneNumberType": "tollFree",
"assignmentType": "application",
"capabilities": {
"sms": "inbound+outbound",
"calling": "none"
},
"areaCode": "425",
"quantity": 1
}
示例响应
Operation-Location: /phoneNumbers/operations/search_378ddf60-81be-452a-ba4f-613198ea6c28
Location: /availablePhoneNumbers/searchResults/378ddf60-81be-452a-ba4f-613198ea6c28
operation-id: search_378ddf60-81be-452a-ba4f-613198ea6c28
search-id: 378ddf60-81be-452a-ba4f-613198ea6c28
{
"searchId": "378ddf60-81be-452a-ba4f-613198ea6c28",
"phoneNumbers": [
"+18001212121"
],
"phoneNumberType": "tollFree",
"assignmentType": "application",
"capabilities": {
"sms": "inbound+outbound",
"calling": "none"
},
"cost": {
"amount": 1.2,
"currencyCode": "USD",
"billingFrequency": "monthly"
},
"searchExpiresBy": "2020-11-19T16:31:49.048Z"
}
定义
名称 | 说明 |
---|---|
Billing |
费用计费的频率。 |
Communication |
通信服务错误。 |
Communication |
通信服务错误。 |
Error |
将错误消息映射到代码 |
Phone |
表示产品/服务的分配类型。 |
Phone |
电话号码的功能。 |
Phone |
调用的功能值。 |
Phone |
单个电话号码产生的成本。 |
Phone |
表示用于查找电话号码的电话号码搜索请求。 找到的电话号码暂时保留,供以下购买。 |
Phone |
电话号码搜索操作的结果。 |
Phone |
表示产品/服务的数量类型。 |
BillingFrequency
费用计费的频率。
名称 | 类型 | 说明 |
---|---|---|
monthly |
string |
CommunicationError
通信服务错误。
名称 | 类型 | 说明 |
---|---|---|
code |
string |
错误代码。 |
details |
有关导致此错误的特定错误的更多详细信息。 |
|
innererror |
内部错误(如果有)。 |
|
message |
string |
错误消息。 |
target |
string |
错误目标。 |
CommunicationErrorResponse
通信服务错误。
名称 | 类型 | 说明 |
---|---|---|
error |
通信服务错误。 |
Error
将错误消息映射到代码
名称 | 类型 | 说明 |
---|---|---|
AllNumbersNotAcquired |
string |
|
AuthorizationDenied |
string |
|
BillingUnavailable |
string |
|
InvalidAddress |
string |
|
InvalidOfferModel |
string |
|
MissingAddress |
string |
|
NoError |
string |
|
NoWallet |
string |
|
NotEnoughCredit |
string |
|
NotEnoughLicenses |
string |
|
NumbersPartiallyAcquired |
string |
|
OutOfStock |
string |
|
ProvisioningFailed |
string |
|
PurchaseFailed |
string |
|
ReservationExpired |
string |
|
UnknownErrorCode |
string |
|
UnknownSearchError |
string |
PhoneNumberAssignmentType
表示产品/服务的分配类型。
名称 | 类型 | 说明 |
---|---|---|
application |
string |
|
person |
string |
PhoneNumberCapabilities
电话号码的功能。
名称 | 类型 | 说明 |
---|---|---|
calling |
调用的功能值。 |
|
sms |
SMS 的功能值。 |
PhoneNumberCapabilityType
调用的功能值。
名称 | 类型 | 说明 |
---|---|---|
inbound |
string |
|
inbound+outbound |
string |
|
none |
string |
|
outbound |
string |
PhoneNumberCost
单个电话号码产生的成本。
名称 | 类型 | 说明 |
---|---|---|
amount |
number |
成本金额。 |
billingFrequency |
费用计费的频率。 |
|
currencyCode |
string |
成本金额的 ISO 4217 货币代码,例如美元。 |
PhoneNumberSearchRequest
表示用于查找电话号码的电话号码搜索请求。 找到的电话号码暂时保留,供以下购买。
名称 | 类型 | 默认值 | 说明 |
---|---|---|---|
areaCode |
string |
所需电话号码的区号,例如 425。 |
|
assignmentType |
要搜索的电话号码的分配类型。 可将电话号码分配给人员或应用程序。 |
||
capabilities |
电话号码的功能。 |
||
phoneNumberType |
要搜索的电话号码类型,例如地理或 tollFree。 |
||
quantity |
integer |
1 |
所需电话号码的数量。 默认值为 1。 |
PhoneNumberSearchResult
电话号码搜索操作的结果。
名称 | 类型 | 说明 |
---|---|---|
assignmentType |
电话号码的分配类型。 |
|
capabilities |
电话号码的功能。 |
|
cost |
单个电话号码产生的成本。 |
|
error |
将错误消息映射到代码 |
|
errorCode |
integer |
搜索的错误代码。 |
phoneNumberType |
电话号码的类型,例如地理或 tollFree。 |
|
phoneNumbers |
string[] |
可用的电话号码。 可以小于所需的搜索数量。 |
searchExpiresBy |
string |
此搜索结果过期的日期和电话号码不再处于保留状态。 搜索结果的过期时间小于 15 分钟,例如 2020-11-19T16:31:49.048Z。 |
searchId |
string |
搜索 ID。 |
PhoneNumberType
表示产品/服务的数量类型。
名称 | 类型 | 说明 |
---|---|---|
geographic |
string |
|
tollFree |
string |