Postal code query
This operation retrieves the postal code for a specified address. By default, the results are accurate to the district or county level.
Testing
You can test this API in the Address Purification console.
Request parameters
Name | Type | Required | Sample value | Description |
Action | String | Yes | GetZipcode | A required parameter. Set the value to GetZipcode. |
AppKey | String | Yes | Axqwerasdf1a | The AppKey of your project. |
ServiceCode | String | Yes | addrp | A static field. Set the value to addrp. |
Text | String | Yes | No. 969, Wenyixi Road, Hangzhou City, Zhejiang Province | The text content. |
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 data
Name | Type | Sample value | Description |
Data | String | {"zipcode":"311100","time_used":{"rt":{"zipcode":"0.004756927490234375","complete":"0.020321130752563477","structure":"0.007731199264526367"},"start":"1589800854.316437"},"status":"OK"} | zipcode: The postal code. Currently, only postal codes in the Chinese mainland are supported. time_used: The time consumed by the algorithm. status: The status. |
RequestId | String | D0078DC6-8A1F-41A0-9A5F-A6B6443E9A65 | The ID of the request. |
Examples
Request example
http(s)://[Endpoint]/?Action=GetZipcode
&AppKey=Axqwerasdf1a
&ServiceCode=addrp
&Text=No. 969, Wenyixi Road, Hangzhou City, Zhejiang Province
&<Common request parameters>Successful response example
XML format
<RequestId>D0078DC6-8A1F-41A0-9A5F-A6B6443E9A65</RequestId>
<Data>
<zipcode>311100</zipcode>
<time_used>
<rt>
<zipcode>0.004756927490234375</zipcode>
<complete>0.020321130752563477</complete>
<structure>0.007731199264526367</structure>
</rt>
<start>1589800854.316437</start>
</time_used>
<status>OK</status>
</Data>JSON format
{
"RequestId": "D0078DC6-8A1F-41A0-9A5F-A6B6443E9A65",
"Data": {
"zipcode": "311100",
"time_used": {
"rt": {
"zipcode": "0.004756927490234375",
"complete": "0.020321130752563477",
"structure": "0.007731199264526367"
},
"start": "1589800854.316437"
},
"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 fault 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 Error Center.