行政区划
行政区划级联
描述
生成三级级联的行政区划信息
数据来源于民政部、国家统计局中华人民共和国行政区划代码
请求地址
https://api.ecnu.edu.cn/api/v1/metadata/divisions-all
请求参数
无
返回参数
参数名 | 类型 | 备注 |
---|---|---|
code | string | 省级代码/地级代码/县级代码 |
name | string | 省级名称/地级名称/县级名称 |
children | object array | 下一级的行政区划代码,数组 |
返回示例
json
{
"errCode": 0,
"errMsg": "success",
"requestId": "586672f9-445b-48e3-b8fb-bbd14a06517f",
"data": [
{
"code": "11",
"name": "北京市",
"children": [
{
"code": "1101",
"name": "市辖区",
"children": [
{
"code": "110101",
"name": "东城区"
},
{
"code": "110102",
"name": "西城区"
},
{
"code": "110105",
"name": "朝阳区"
},
{
"code": "110106",
"name": "丰台区"
},
{
"code": "110107",
"name": "石景山区"
},
{
"code": "110108",
"name": "海淀区"
},
{
"code": "110109",
"name": "门头沟区"
},
{
"code": "110111",
"name": "房山区"
},
{
"code": "110112",
"name": "通州区"
},
{
"code": "110113",
"name": "顺义区"
},
{
"code": "110114",
"name": "昌平区"
},
{
"code": "110115",
"name": "大兴区"
},
{
"code": "110116",
"name": "怀柔区"
},
{
"code": "110117",
"name": "平谷区"
},
{
"code": "110118",
"name": "密云区"
},
{
"code": "110119",
"name": "延庆区"
}
]
}
]
}
]
}
行政区划查询
描述
根据代码查询下一级的行政区划信息
数据来源于民政部、国家统计局中华人民共和国行政区划代码
请求地址
https://api.ecnu.edu.cn/api/v1/metadata/divisions
请求参数
参数名 | 是否必填 | 备注 |
---|---|---|
pageNum | 是 | 分页代码,从1开始 |
pageSize | 是 | 分页的大小 |
provinceCode | 否 | 省级(省份、直辖市、自治区) |
cityCode | 否 | 地级(城市) |
areaCode | 否 | 县级(区县) |
streetCode | 否 | 乡级(乡镇、街道) |
多个代码的参数同时提交时,只有一个参数有效。
参数优先级为 streetCode > areaCode > cityCode > provinceCode
返回参数
参数名 | 类型 | 备注 |
---|---|---|
code | string | 行政区划代码 |
name | string | 行政区划名称 |
请求示例1——
curl "https://api.ecnu.edu.cn/api/v1/metadata/divisions?pageNum=1&pageSize=10"
返回示例1
json
{
"data": {
"totalNum": 34,
"pageSize": 10,
"rows": [
{
"code": "11",
"name": "北京市"
},
{
"code": "12",
"name": "天津市"
},
{
"code": "13",
"name": "河北省"
},
{
"code": "14",
"name": "山西省"
},
{
"code": "15",
"name": "内蒙古自治区"
},
{
"code": "21",
"name": "辽宁省"
},
{
"code": "22",
"name": "吉林省"
},
{
"code": "23",
"name": "黑龙江省"
},
{
"code": "31",
"name": "上海市"
},
{
"code": "32",
"name": "江苏省"
}
],
"pageNum": 1
},
"errCode": 0,
"requestId": "0bc16ec116400651475561371e5f40",
"errMsg": "success",
"apiLog": null
}
请求示例2
curl -i -H "Authorization: Bearer 0bc16ec116400651475561371e5f40" "https://api.ecnu.edu.cn/api/v1/metadata/divisions?pageNum=1&pageSize=10&provinceCode=13"
返回示例2
json
{
"data": {
"totalNum": 11,
"pageSize": 10,
"rows": [
{
"code": "1301",
"name": "石家庄市"
},
{
"code": "1302",
"name": "唐山市"
},
{
"code": "1303",
"name": "秦皇岛市"
},
{
"code": "1304",
"name": "邯郸市"
},
{
"code": "1305",
"name": "邢台市"
},
{
"code": "1306",
"name": "保定市"
},
{
"code": "1307",
"name": "张家口市"
},
{
"code": "1308",
"name": "承德市"
},
{
"code": "1309",
"name": "沧州市"
},
{
"code": "1310",
"name": "廊坊市"
}
],
"pageNum": 1
},
"errCode": 0,
"requestId": "0a98a33e16400656515707901e0cbc",
"errMsg": "success",
"apiLog": null
}
请求示例3
curl -i -H "Authorization: Bearer 0bc16ec116400651475561371e5f40" "https://api.ecnu.edu.cn/api/v1/metadata/divisions?pageNum=1&pageSize=10&cityCode=1101"
返回示例3
json
{
"data": {
"totalNum": 16,
"pageSize": 10,
"rows": [
{
"code": "110101",
"name": "东城区"
},
{
"code": "110102",
"name": "西城区"
},
{
"code": "110105",
"name": "朝阳区"
},
{
"code": "110106",
"name": "丰台区"
},
{
"code": "110107",
"name": "石景山区"
},
{
"code": "110108",
"name": "海淀区"
},
{
"code": "110109",
"name": "门头沟区"
},
{
"code": "110111",
"name": "房山区"
},
{
"code": "110112",
"name": "通州区"
},
{
"code": "110113",
"name": "顺义区"
}
],
"pageNum": 1
},
"errCode": 0,
"requestId": "0a98a33e16400658278764813e0cbc",
"errMsg": "success",
"apiLog": null
}
请求示例4
curl -i -H "Authorization: Bearer 0bc16ec116400651475561371e5f40" "https://api.ecnu.edu.cn/api/v1/metadata/divisions?pageNum=1&pageSize=10&areaCode=110101"
返回示例4
json
{
"data": {
"totalNum": 17,
"pageSize": 10,
"rows": [
{
"code": "110101001",
"name": "东华门街道"
},
{
"code": "110101002",
"name": "景山街道"
},
{
"code": "110101003",
"name": "交道口街道"
},
{
"code": "110101004",
"name": "安定门街道"
},
{
"code": "110101005",
"name": "北新桥街道"
},
{
"code": "110101006",
"name": "东四街道"
},
{
"code": "110101007",
"name": "朝阳门街道"
},
{
"code": "110101008",
"name": "建国门街道"
},
{
"code": "110101009",
"name": "东直门街道"
},
{
"code": "110101010",
"name": "和平里街道"
}
],
"pageNum": 1
},
"errCode": 0,
"requestId": "0a98a33e16400659138367768e0cbc",
"errMsg": "success",
"apiLog": null
}
请求示例5
curl -i -H "Authorization: Bearer 0bc16ec116400651475561371e5f40" "https://api.ecnu.edu.cn/api/v1/metadata/divisions?pageNum=1&pageSize=10&streetCode=110101001"
返回示例5
json
{
"data": {
"totalNum": 12,
"pageSize": 10,
"rows": [
{
"code": "110101001001",
"name": "多福巷社区居委会"
},
{
"code": "110101001002",
"name": "银闸社区居委会"
},
{
"code": "110101001005",
"name": "东厂社区居委会"
},
{
"code": "110101001006",
"name": "智德社区居委会"
},
{
"code": "110101001007",
"name": "南池子社区居委会"
},
{
"code": "110101001008",
"name": "黄图岗社区居委会"
},
{
"code": "110101001009",
"name": "灯市口社区居委会"
},
{
"code": "110101001010",
"name": "正义路社区居委会"
},
{
"code": "110101001011",
"name": "甘雨社区居委会"
},
{
"code": "110101001013",
"name": "台基厂社区居委会"
}
],
"pageNum": 1
},
"errCode": 0,
"requestId": "0a98a33e16400659791441580e0cbc",
"errMsg": "success",
"apiLog": null
}