获取城市列表
接口说明:获取城市区域信息(包括海外城市)。
请求方式: POST(HTTPS)
请求地址:https://api.xinrenxinshi.com/v5/common/city/all
请求Header:
key | value |
---|---|
access_token | 获取的access_token的实际值 |
Query参数:
key | value |
---|---|
sign | 签名值 |
Body参数:
参数 | 参数类型 | 必传(Y/N) | 说明 |
---|---|---|---|
timestamp | Long | Y | 请求时间戳(精确到毫秒) |
type | Integer | Y | 0-全部地区,1-国内地区,2-国际地区。默认查询全部地区 |
返回结果:
参数 | 类型 | 必传(Y/N) | 说明 |
---|---|---|---|
errcode | Integer | Y | 0成功,其他失败 |
errmsg | String | Y | 结果描述 |
data | List<AreaModel> | Y | 区域信息列表 |
AreaModel
参数 | 类型 | 必传(Y/N) | 说明 |
---|---|---|---|
id | Integer | Y | 区域编码 |
name | String | Y | 区域名称 |
type | Integer | Y | 区域类型,2-省级,3-城市,4-区级 |
parentId | Integer | Y | 父级区域编码id |
isPrimary | Integer | Y | 是否主要区域,0-否,1-是(暂无作用) |
fullName | String | Y | 区域全称 |
adcode | String | N | 地区编码 |
areaType | Integer | N | 地区类型,1-国内地区,2-国际地区 |
请求示例(HTTPS):
https://api.xinrenxinshi.com/v5/common/city/all?sign=26dAzTk%2BzeMz%2Bx45d8SRniM1PTk%3D
请求Body示例:
{
"timestamp": 1606183503814,
"type": 0
}
SDK请求示例(java):
CityAllListRequest request = new CityAllListRequest(access_token());
request.setType(0);
OpenapiResponse<List<AreaModel>> cityList = XrxsCommonService.getCityAllList(request);
响应实例:
{
"errcode": 0,
"errmsg": "成功",
"data": [
{
"adcode":"110000",
"areaType":1,
"fullName":"北京市",
"id":1,
"isPrimary":0,
"name":"北京市",
"parentId":0,
"type":2
},
{
"adcode":"110000",
"areaType":1,
"fullName":"北京市北京市",
"id":2,
"isPrimary":0,
"name":"北京市",
"parentId":1,
"type":3
},
{
"adcode":"130000",
"areaType":1,
"fullName":"河北省",
"id":19,
"isPrimary":0,
"name":"河北省",
"parentId":0,
"type":2
},
{
"adcode":"140000",
"areaType":1,
"fullName":"山西省",
"id":20,
"isPrimary":0,
"name":"山西省",
"parentId":0,
"type":2
},
{
"adcode":"",
"areaType":2,
"fullName":"哈萨克斯坦沙赫京斯克",
"id":101164,
"isPrimary":0,
"name":"沙赫京斯克",
"parentId":10110,
"type":3
},
{
"adcode":"",
"areaType":2,
"fullName":"哈萨克斯坦斯捷普诺戈尔斯克",
"id":101167,
"isPrimary":0,
"name":"斯捷普诺戈尔斯克",
"parentId":10110,
"type":3
}
]
}