Document Web Service Guides Administrative Division Query

Administrative Division Query

Product Introduction

The Administrative Division Query API is a simple HTTP interface that enables you to quickly retrieve administrative region information based on your search criteria.

For example: Japan > Tokyo > Machida City.

Before You Begin

1
Step 1
Apply for a 【Web Service API】 Key
2
Step 2
Enable overseas access for the applied Key by submitting a ticket to request the required permissions
3
Step 3
Construct the HTTP request URL, including the Key obtained in Step 1 as a required parameter
4
Step 4
Receive and parse the data returned from the HTTP request (in JSON or XML format)
Unless otherwise specified, all input parameters and output data are encoded in UTF-8.

Administrative Division Query

Administrative Division Query API Service URL

URL

https://sg-restapi.opnavi.com/v5/district/global?parameters

Request Method

GET

The parameters represent both required and optional parameters. All parameters are separated by the ampersand character (&). The list below enumerates these parameters and their usage rules.

Request Parameters

Name

Meaning

Rule Description

Required

Default

key

Service authorization token

Apply for a Web Service API Key and submit a work order for overseas permissions on the Amap official website.

Yes

None

keywords

Search keyword

Only single keyword search is supported. Keywords support: administrative region names. For example, when subdistrict=1, searching for a country (e.g., Japan) will display level 2 administrative divisions (e.g., Tokyo).

Yes

None

subdistrict

Subordinate administrative level

Sets the number of subordinate administrative levels to display. Administrative levels: level1=country, level2=province/municipality/state, level3=city, level4=district/county.

Optional values: 0, 1, 2, etc.

0: Do not return subordinate administrative regions.

1: Return the next level of administrative regions.

2: Return the next two levels of administrative regions.

Note: Different countries have different administrative division rules. For example, in Japan, Tokyo and Toyama Prefecture both belong to level2.

No

1

langCode

Response language

Default is zh (Chinese). Optional values: 

zh (Chinese)

en (English)

es (Spanish)

pt (Portuguese)

fr (French)

de (German)

th (Thai)

ja (Japanese)

ko (Korean)

ar (Arabic)

tr (Turkish)

he (Hebrew)

it (Italian)

ru (Russian)

ms (Malay)

id (Indonesian)

vi (Vietnamese)

pl (Polish)

cs (Czech)

uk (Ukrainian)

az (Azerbaijani).

No

en

page

Page number

The outermost districts return up to 20 items per page. If the limit is exceeded, use this parameter to request subsequent pages. For example: page=2, page=3.

No

1

offset

Number of outermost results

Specifies the number of outermost data items to return per page.

No

20

callback

Callback function

The callback value is a user-defined function name. This parameter is only valid when output=JSON.

No

-

output

Response data format

Optional value: JSON.

No

JSON

Examples

https://sg-restapi.opnavi.com/v5/district/global?keywords=392000000&key=<your key>&subdistrict=1&LanguageCode=en

Response Parameters Description

Name

Description

Specification

status

Response status

0: Request failed; 1: Request succeeded.

info

Status description

When status is 0, info returns the error reason. Otherwise, it returns 'OK'. For details, refer to the info status table.

infocode

Status code

For details, refer to the infocode in the info status table.

districts

Administrative division list

Contains district elements.

district

Administrative division information

Child element containing the following fields.

adcode

Area code

A 9-digit number. Digits 1–3 represent Level 1 (country); digits 4–5 represent Level 2 (province/state); digits 6–7 represent Level 3 (city); digits 8–9 represent Level 4 (district).

name

Administrative division name

The name of the administrative region.

center

Regional center point

The geographic center coordinates of the region.

level

Administrative level

Level 1: Country. Level 2: Usually province or state. Level 3: Usually city. Level 4: Usually district.

districts

Subordinate administrative list

A list of subordinate administrative divisions, containing district elements.