Extract phone numbers
Extracts phone number segments from natural text.
Test
You can test the API in the Address Purification console.
Request parameters
Name | Type | Required | Example | Description |
Action | String | Yes | ExtractPhone | A required parameter. Set the value to ExtractPhone. |
AppKey | String | Yes | Axqwerasdf1a | The AppKey of the project. |
ServiceCode | String | Yes | addrp | A static field. The value is addrp. |
Text | String | Yes | No. 969, Wenyi West Road, 1333333**** | A segment of natural text that contains a phone number. |
DefaultProvince | String | No | Zhejiang Province | The default province. |
DefaultCity | String | No | Hangzhou City | The default city. |
DefaultDistrict | String | No | Yuhang District | The default administrative region. |
Response parameters
Name | Type | Example value | Description |
Data | String | {"phone_extract":[{"start":8,"end":19,"type":"TEL","word":"1333333****"}],"time_used":{"rt":{"phone_extract":"0.014524221420288086"},"start":"1589800189.9369104"},"status":"OK"} | start: The start position of the field in the original text. end: The end position of the field in the original text. type: The field type. TEL indicates a telephone number. word: The detected entity field. time_used: The time consumed by the algorithm. Status |
RequestId | String | A602539D-A298-4643-A268-94F0B893C12F | RequestId |
Examples
Request example
http(s)://[Endpoint]/?Action=ExtractPhone
&AppKey=Axqwerasdf1a
&ServiceCode=addrp
&Text=No. 969, Wenyi West Road, 1333333****
&<Common request parameters>Successful response example
XML format
<RequestId>A602539D-A298-4643-A268-94F0B893C12F</RequestId>
<Data>
<phone_extract>
<start>8</start>
<end>19</end>
<type>TEL</type>
<word>1333333****</word>
</phone_extract>
<time_used>
<rt>
<phone_extract>0.014524221420288086</phone_extract>
</rt>
<start>1589800189.9369104</start>
</time_used>
<status>OK</status>
</Data>JSON format
{
"RequestId": "A602539D-A298-4643-A268-94F0B893C12F",
"Data": {
"phone_extract": [
{
"start": 8,
"end": 19,
"type": "TEL",
"word": "1333333****"
}
],
"time_used": {
"rt": {
"phone_extract": "0.014524221420288086"
},
"start": "1589800189.9369104"
},
"status": "OK"
}
}Error codes
HttpCode | Error code | Error message | Description |
403 | Forbidden.NoAuth | Failed to perform user authentication. | User authentication failed. |
500 | InternalError | A service error occurred. | An internal service error occurred. |
400 | InvalidParameter | The parameter is invalid. | The parameter is invalid. |
404 | ResourceDoesNotExist | The resource does not exist. | The resource does not exist. |
429 | Throttling.User | Flow control has been triggered. | Throttling is triggered. |
400 | UserStatusInvalid | The user status is invalid. | The user status is invalid. |
For more information about error codes, see the Error Center.