## 邮编查询(免费) ![](https://img.kancloud.cn/35/4d/354df93647aa487adaceba1a3fc9b2b5_175x136.png) > 提供全国邮政编码大全,为你快速准确查邮编 每日100次免费调用 ## 接口调用([调用须知](https://docs.topthink.com/think-api/1835086)) ## 接口1:通过邮编查询对应的地名 ### 请求地址 ``` GET https://api.topthink.com/postcode/query ``` ### 请求参数 | 名称 | 必填 | 类型 | 说明 | | --- | --- | --- | --- | | appCode| 是| string|用户授权码,参考[API调用](https://docs.topthink.com/think-api/1835086) | | postcode | 是 | string | 邮编,如:215001 | | page | 否 | int | 页数,默认1 | | pagesize | 否 | int | 每页返回,默认:20,最大不超过50 | ### 返回`data`参数 | 名称 | 类型 | 说明 | | --- | --- | --- | | 参考返回数据 | ## SDK调用 ``` $client = new Client("YourAppCode"); $result = $client->postcodeQuery() ->withPostcode('215001') ->request(); dump($result); ``` 返回数据示例: ~~~ { "code": 0, "message": "成功", "data": { "list": [ { "PostNumber": "215001", "Province": "江苏省", "City": "苏州市", "District": "平江区", "Address": "廖家巷新光里" }, { "PostNumber": "215001", "Province": "江苏省", "City": "苏州市", "District": "平江区", "Address": "龙兴桥顺德里" } ], "totalcount": 352, "totalpage": 176, "currentpage": 1, "pagesize": "2" }, } ~~~ ## 接口2:省份、城市、地区(县)关联的列表 ### 请求地址 ``` GET https://api.topthink.com/postcode/pcd ``` ### 请求参数 无 ### 返回`data`参数 | 名称 | 类型 | 说明 | | --- | --- | --- | | 参考返回数据 | ## SDK调用 ``` $client = new Client("YourAppCode"); $result = $client->postcodePcd() ->request(); dump($result); ``` 返回数据示例: ~~~ { "code": 0, "message": "成功", "data": { { "id":"1", "province":"上海市", "city":[ { "id":"32", "city":"上海市", "district":[ { "id":"798", "district":"南汇区" }, { "id":"799", "district":"卢湾区" }, { "id":"800", "district":"嘉定区" }, { "id":"801", "district":"奉贤区" }, { "id":"802", "district":"宝山区" }, { "id":"803", "district":"崇明县" }, { "id":"804", "district":"徐汇区" }, { "id":"805", "district":"普陀区" }, { "id":"806", "district":"杨浦区" }, { "id":"807", "district":"松江区" }, { "id":"808", "district":"浦东新区" }, { "id":"809", "district":"虹口区" }, { "id":"810", "district":"金山区" }, { "id":"811", "district":"长宁区" }, { "id":"812", "district":"闵行区" }, { "id":"813", "district":"闸北区" }, { "id":"814", "district":"青浦区" }, { "id":"815", "district":"静安区" }, { "id":"816", "district":"黄浦区" } ] } ] }, }, } ~~~ ## 接口3:根据相关条件查询符合条件地区的邮编 ### 请求地址 ``` GET https://api.topthink.com/postcode/search ``` ### 请求参数 | 名称 | 必填 | 类型 | 说明 | | --- | --- | --- | --- | | appCode| 是| string|用户授权码,参考[API调用](https://docs.topthink.com/think-api/1835086) | | pid | 是 | int | 省份ID | | cid | 是 | int | 城市ID | | did | 否 | int | 区域ID | | q | 否 | string | 地名关键字,如:木渎 | | page | 否 | int | 第几页,默认为第1页 | | pagesize | 否 | int | 每页显示条数,(1-50)默认20条, | ### 返回`data`参数 | 名称 | 类型 | 说明 | | --- | --- | --- | | 参考返回数据 | ## SDK调用 ``` $client = new Client("YourAppCode"); $result = $client->postcodeSearch() ->withPid(1) ->withCid(32) ->withQ('徐家汇') ->request(); dump($result); ``` 返回数据示例: ~~~ { "code": 0, "message": "成功", "data": { "list":[ { "PostNumber":"200023", "Province":"上海市", "City":"上海市", "District":"卢湾区", "Address":"徐家汇路1-999号(单号)" }, { "PostNumber":"200025", "Province":"上海市", "City":"上海市", "District":"卢湾区", "Address":"徐家汇路28-648号(双号)" }, { "PostNumber":"200023", "Province":"上海市", "City":"上海市", "District":"卢湾区", "Address":"徐家汇路1-999弄(单号)" }, { "PostNumber":"200025", "Province":"上海市", "City":"上海市", "District":"卢湾区", "Address":"徐家汇路28-648弄(双号)" } ], "totalcount":4, "totalpage":1, "currentpage":1, "pagesize":20 ... ] }, } ~~~