GET /location/chinaregions| 参数 | 位置 | 类型 | 必填 | 真实默认值 | 说明 |
|---|---|---|---|---|---|
| appkey | query | string | 否 | 无 | 付费后获取的 APPKEY |
| regionCode | query | string | 否 | 无 | 需要查询的父级区域编码,传递 0 获取全国所有省级别数据;编码格式为 00000000,每两位分别对应省、市、区、镇/街道编码(注意:v2 版本会在国家 6 位行政区划标准代码后添加 00 两位编码以保持接口兼容,v3 版本为 12 位编码格式) |
| version | query | string | 否 | 当传递参数值为 2 时,调用 v2 版本的接口,regioncode 遵循国家行政区划代码标准,同时可返回新增区划中心点坐标。当传递参数值为 3 时,调用 v3 版本的接口(v1 版本主要为了兼容历史用户调用逻辑,新用户强烈建议调用 v3 接口) | |
| keyword | query | string | 否 | 无 | v3 地名或代码字面关键词检索;不执行正则表达式。 |
| level | query | string | 否 | 无 | v3 层级:province/city/area或district/town或street/village或committee,兼容 1–5 及既有中文表达。 |
| parentCode | query | string | 否 | 无 | v3 父码或 2/4/6/9 位前缀;与关键词、层级条件共同筛选。0 表示不限定父码。 |
| page | query | integer | 否 | 1 | v3 检索页码,默认 1;小于 1 按既有行为归一为 1。直接子级查询保留既有不分页行为。 |
| pageSize | query | integer | 否 | 20 | v3 检索默认 20、最多 100;小于 1 归一为 20。导出默认 1000、最多 1000。 |
{
"regionCode": "0",
"version": "3"
}application/json{
"oneOf": [
{
"type": "object",
"required": [
"DataStatus",
"Data"
],
"properties": {
"DataStatus": {
"type": "object",
"required": [
"RequestParameter",
"StatusCode",
"StatusDescription",
"ResponseDateTime",
"DataTotalCount"
],
"properties": {
"RequestParameter": {
"type": "string",
"description": "请求参数,一般用于调试"
},
"StatusCode": {
"type": "integer",
"description": "接口返回状态码"
},
"StatusDescription": {
"type": "string",
"description": "接口返回状态说明"
},
"ResponseDateTime": {
"type": "string",
"description": "接口数据返回时间"
},
"DataTotalCount": {
"type": "integer",
"description": "此条件下的总数据量,一般用于分页计算"
}
}
},
"Data": {
"type": "array",
"items": {
"type": "object",
"required": [
"RegionCode",
"RegionName",
"RegionType",
"CenterLonLat"
],
"additionalProperties": false,
"properties": {
"RegionCode": {
"type": "string",
"description": "区域编码(在 v2 版本中,前六位为国家行政区划标准编码,镇/街道是没有国家标准编码的,对应的编码只是对应的序号。v3 版本中,为最新的 12 位国家行政区划标准编码。)"
},
"RegionName": {
"type": "string",
"description": "区域名称(部分城市在“市”级别后没有“区”级别,会直接返回“镇/街道”信息,注意根据「区域级别」字段进行处理)"
},
"RegionType": {
"type": "string",
"description": "区域级别,枚举值为:省/自治区/直辖市/特别行政区 | 市 | 区 | 镇/街道 | 居委会/村"
},
"CenterLonLat": {
"type": [
"string",
"null"
],
"description": "部分数据包含区划中心点坐标,格式为 [经度,纬度],地理坐标系为 GCJ-02。需要转换坐标系请调用<a href='https://www.gugudata.com/api/details/coordinateconverter' target='_blank'>地理坐标系转换</a>接口"
}
},
"description": "随版本变化的区域对象数组;旧版四字段,v3 为十九字段。"
},
"description": "随版本变化的区域对象数组;旧版四字段,v3 为十九字段。"
}
}
},
{
"type": "object",
"required": [
"DataStatus",
"Data"
],
"properties": {
"DataStatus": {
"type": "object",
"required": [
"RequestParameter",
"StatusCode",
"StatusDescription",
"ResponseDateTime",
"DataTotalCount"
],
"properties": {
"RequestParameter": {
"type": "string",
"description": "请求参数,一般用于调试"
},
"StatusCode": {
"type": "integer",
"description": "接口返回状态码"
},
"StatusDescription": {
"type": "string",
"description": "接口返回状态说明"
},
"ResponseDateTime": {
"type": "string",
"description": "接口数据返回时间"
},
"DataTotalCount": {
"type": "integer",
"description": "此条件下的总数据量,一般用于分页计算"
}
}
},
"Data": {
"type": "array",
"items": {
"type": "object",
"required": [
"RegionCode",
"RegionName",
"RegionType",
"RegionLevel",
"FullRegionName",
"ParentRegionCode",
"ProvinceCode",
"ProvinceName",
"CityCode",
"CityName",
"AreaCode",
"AreaName",
"TownCode",
"TownName",
"VillageCode",
"VillageName",
"V2Code",
"CenterLonLat",
"AdCode"
],
"additionalProperties": false,
"properties": {
"RegionCode": {
"type": "string",
"description": "区域编码(在 v2 版本中,前六位为国家行政区划标准编码,镇/街道是没有国家标准编码的,对应的编码只是对应的序号。v3 版本中,为最新的 12 位国家行政区划标准编码。)"
},
"RegionName": {
"type": "string",
"description": "区域名称(部分城市在“市”级别后没有“区”级别,会直接返回“镇/街道”信息,注意根据「区域级别」字段进行处理)"
},
"RegionType": {
"type": "string",
"description": "区域级别,枚举值为:省/自治区/直辖市/特别行政区 | 市 | 区 | 镇/街道 | 居委会/村"
},
"RegionLevel": {
"type": "integer",
"description": "层级 1–5,分别为省、市、区县、乡镇街道、村居。"
},
"FullRegionName": {
"type": "string",
"description": "可用各级名称按原顺序拼接的全名。"
},
"ParentRegionCode": {
"type": "string",
"description": "既有父级十二位编码;省级父码为 0。"
},
"ProvinceCode": {
"type": "string",
"description": "省级十二位编码;没有该级信息时保留空字符串。"
},
"ProvinceName": {
"type": "string",
"description": "省级名称;没有资料时保留空字符串。"
},
"CityCode": {
"type": "string",
"description": "市级十二位编码;没有该级信息时保留空字符串。"
},
"CityName": {
"type": "string",
"description": "市级名称;没有资料时保留空字符串。"
},
"AreaCode": {
"type": "string",
"description": "区县十二位编码;没有该级信息时保留空字符串。"
},
"AreaName": {
"type": "string",
"description": "区县名称;没有资料时保留空字符串。"
},
"TownCode": {
"type": "string",
"description": "乡镇街道十二位编码;没有该级信息时保留空字符串。"
},
"TownName": {
"type": "string",
"description": "乡镇街道名称;没有资料时保留空字符串。"
},
"VillageCode": {
"type": "string",
"description": "村居十二位编码;没有该级信息时保留空字符串。"
},
"VillageName": {
"type": "string",
"description": "村居名称;没有资料时保留空字符串。"
},
"V2Code": {
"type": [
"string",
"null"
],
"description": "可用的 v2 对照编码,没有对应资料时为空。"
},
"CenterLonLat": {
"type": [
"string",
"null"
],
"description": "部分数据包含区划中心点坐标,格式为 [经度,纬度],地理坐标系为 GCJ-02。需要转换坐标系请调用<a href='https://www.gugudata.com/api/details/coordinateconverter' target='_blank'>地理坐标系转换</a>接口"
},
"AdCode": {
"type": [
"string",
"null"
],
"description": "可用的来源行政区划参考编码;不以统计村居编码冒充行政区划码。"
}
},
"description": "随版本变化的区域对象数组;旧版四字段,v3 为十九字段。"
},
"description": "随版本变化的区域对象数组;旧版四字段,v3 为十九字段。"
}
}
}
]
}application/json{
"$ref": "#/components/schemas/CommonResponse"
}application/json{
"$ref": "#/components/schemas/CommonResponse"
}application/json{
"$ref": "#/components/schemas/CommonResponse"
}application/json{
"$ref": "#/components/schemas/CommonResponse"
}application/json{
"type": "object",
"properties": {
"DataStatus": {
"type": "object",
"required": [
"RequestParameter",
"StatusCode",
"StatusDescription",
"ResponseDateTime",
"DataTotalCount"
],
"properties": {
"RequestParameter": {
"type": "string",
"description": "请求参数,一般用于调试"
},
"StatusCode": {
"type": "integer",
"description": "接口返回状态码"
},
"StatusDescription": {
"type": "string",
"description": "接口返回状态说明"
},
"ResponseDateTime": {
"type": "string",
"description": "接口数据返回时间"
},
"DataTotalCount": {
"type": "integer",
"description": "此条件下的总数据量,一般用于分页计算"
}
}
},
"Data": {
"type": "null",
"description": "随版本变化的区域对象数组;旧版四字段,v3 为十九字段。"
}
}
}application/json{
"type": "object",
"properties": {
"DataStatus": {
"type": "object",
"required": [
"RequestParameter",
"StatusCode",
"StatusDescription",
"ResponseDateTime",
"DataTotalCount"
],
"properties": {
"RequestParameter": {
"type": "string",
"description": "请求参数,一般用于调试"
},
"StatusCode": {
"type": "integer",
"description": "接口返回状态码"
},
"StatusDescription": {
"type": "string",
"description": "接口返回状态说明"
},
"ResponseDateTime": {
"type": "string",
"description": "接口数据返回时间"
},
"DataTotalCount": {
"type": "integer",
"description": "此条件下的总数据量,一般用于分页计算"
}
}
},
"Data": {
"type": "null",
"description": "随版本变化的区域对象数组;旧版四字段,v3 为十九字段。"
}
}
}| 业务码 | 含义 | 说明 |
|---|---|---|
| 100 | 成功 | HTTP 200;仍应检查业务状态。 |
| 501 | 参数错误 | HTTP 400 |
| 900 | 依赖失败 | HTTP 500 |