调用QueryPhoneNumberAttribute获取号码当前服务运营商、归属地和携号转网信息。

QueryPhoneNumberAttribute接口是号码归属地查询接口,支持在一次请求中获取一个号码当前服务运营商和归属地。

调用该接口获取号码归属地时,请注意:

该请求会根据发送量计费,价格请参见计费说明

说明 在使用接口前,请参见公共参数调用方式等公共信息。

调试

您可以在OpenAPI Explorer中直接运行该接口,免去您计算签名的困扰。运行成功后,OpenAPI Explorer可以自动生成SDK代码示例。

请求参数

名称 类型 是否必选 示例值 描述
Action String QueryPhoneNumberAttribute

系统规定参数。取值:QueryPhoneNumberAttribute

PhoneNumber String 1511234****

要查询的手机号码。

返回数据

名称 类型 示例值 描述
Code String OK

请求状态码。取值:

  • OK:成功。
  • isp.NUMBER_NON_EXISTENT:传入的手机号查不到归属结果。
  • isv.INVALID_PARAMETERS:非法参数。
  • isp.SYSTEM_ERROR:网元系统异常。
  • isp.QPS_LIMIT:触发QPS限制。
Message String OK

状态码的描述。

PhoneNumberAttribute Struct

号码归属信息。

BasicCarrier String 中国移动

基础运营商。详细说明,请参见下表字段含义。取值:

  • 中国移动
  • 中国联通
  • 中国电信
Carrier String 中国移动

实际运营商(含虚拟运营商),如果存在携号转网,则为携转后的运营商。详细说明,请参见下表字段含义。

City String 杭州

号码归属城市。

IsNumberPortability Boolean false

是否携号转网。

NumberSegment Long 1511234

号段。

Province String 浙江

号码归属省份。

RequestId String CC3BB6D2-2FDF-4321-9DCE-B38165CE4C47

请求ID。

BasicCarrier和Carrier字段含义:

手机号段归属

是否有携号转网

BasicCarrier字段返回结果

Carrier字段返回结果

基础运营商号段

携转后基础运营商(移动、联通、电信)

携转后基础运营商(移动、联通、电信)

基础运营商号段

基础运营商(移动、联通、电信)

基础运营商(移动、联通、电信)

虚拟运营商号段

暂不支持

基础运营商(移动、联通、电信)

虚拟运营商(如:阿里通信等)

示例

请求示例

http(s)://dytnsapi.aliyuncs.com/?Action=QueryPhoneNumberAttribute
&PhoneNumber=1511234****
&<公共请求参数>

正常返回示例

XML格式

<QueryPhoneNumberAttributeResponse>
  <RequestId>CC3BB6D2-2FDF-4321-9DCE-B38165CE4C47</RequestId>
  <Message>OK</Message>
  <PhoneNumberAttribute>
        <BasicCarrier>中国移动</BasicCarrier>
        <NumberSegment>1511234</NumberSegment>
        <IsNumberPortability>false</IsNumberPortability>
        <Carrier>中国移动</Carrier>
        <City>杭州</City>
        <Province>浙江</Province>
  </PhoneNumberAttribute>
  <Code>OK</Code>
</QueryPhoneNumberAttributeResponse>

JSON格式

{
    "RequestId": "CC3BB6D2-2FDF-4321-9DCE-B38165CE4C47",
    "Message": "OK",
    "PhoneNumberAttribute": {
        "BasicCarrier": "中国移动",
        "NumberSegment": 1511234,
        "IsNumberPortability": false,
        "Carrier": "中国移动",
        "City": "杭州",
        "Province": "浙江"
    },
    "Code": "OK"
}

错误码

HttpCode 错误码 错误信息 描述
400 InvalidParameter The specified parameter is invalid. 参数异常
400 OutOfService The ISV is out of service. 业务已停机
400 Product.Unsubscript You have not subscribed to the specified product. 未订阅该功能
400 Queries.Repeated You can only query phoneNumber once every 60 seconds. 60秒内重复查询
400 Ram.PermissionDeny You are not authorized to perform the operation. 权限不足
400 System.LimitControl The system is under flow control. 系统限流控制
400 Unknown.ResourceOwnerId The resource does not belong to the current user. 资源不属于当前用户
400 InvalidParameter The specified mobile phone number is invalid. 非法号码

访问错误中心查看更多错误码。

访问错误中心查看更多错误码。