geoLocation
- Print
- PDF
geoLocation
- Print
- PDF
Article Summary
Share feedback
Thanks for sharing your feedback!
Request
API URL
GET https://geolocation.apigw.ntruss.com/geolocation/v2/geoLocation
Request Header
Header | Description |
---|---|
x-ncp-apigw-timestamp | It is the number of milliseconds that have elapsed since January 1, 1970 00:00:00 UTC. If the time difference with the API Gateway server is more than 5 minutes, the request is considered invalid. x-ncp-apigw-timestamp:{Timestamp} |
x-ncp-iam-access-key | Access Key ID issued from the NAVER Cloud Platform portal. x-ncp-iam-access-key:{Sub Account Access Key} |
x-ncp-apigw-signature-v2 | Signature encrypted with your Access Key ID and Secret Key. x-ncp-apigw-signature-v2:{API Gateway Signature} |
Request Parameters
Parameter | Required | Type | Limitation | Description |
---|---|---|---|---|
ip | Y | String | IPv4 - Wikipedia | User’s IP address based on which you want to know location information. |
enc | N | String | utf8 (default) or euckr | Encoding type of the response result |
ext | N | String | t or f (default) | Indicates whether to include extra information. t: Include f: Not include |
responseFormatType | N | String | xml (default) or json | Format type of the response result |
Response
Property | Type | Description |
---|---|---|
requestId | String | API request ID |
returnCode | String | 0 if it is normal, and an error code if not. |
country | String | County code, including EU (Europe), AP (Asia, Australia), A1 (Anonymous Proxy), A2 (Satellite provider), O1 (Other Country) as well as https://en.wikipedia.org/wiki/ISO_3166. |
code | String | Administrative code defined by the Ministry of Government Administration and Home Affairs in Korea. |
r1 | String | Province, metropolitan city, state |
r2 | String | Si, Gun, Gu |
r3 | String | Dong, Myeon, Eup |
lat | Number | Latitude |
long | Number | Longitude |
net | String | Network operator name |
Example
Request Example
- Korea, ext=f, xml
<getLocationResponse>
<requestId>c4e52003-7879-4216-8eb5-66c93acfd0d2</requestId>
<returnCode>0</returnCode>
<geoLocation>
<country>KR</country>
<code>4113558000</code>
<r1>경기도</r1>
<r2>성남시 분당구</r2>
</geoLocation>
</getLocationResponse>
- Korea, ext=f, json
{
"returnCode": 0,
"requestId": "c4e52003-7879-4216-8eb5-66c93acfd0d2",
"geoLocation": {
"country": "KR",
"code": "4113558000",
"r1": "경기도",
"r2": "성남시 분당구"
}
}
- Outside of Korea, ext=f, xml
<getLocationResponse>
<requestId>c4e52003-7879-4216-8eb5-66c93acfd0d2</requestId>
<returnCode>0</returnCode>
<geoLocation>
<country>US</country>
<code/>
<r1>California</r1>
<r2>San Francisco</r2>
</geoLocation>
</getLocationResponse>
- Outside of Korea, ext=f, json
{
"returnCode": 0,
"requestId": "c4e52003-7879-4216-8eb5-66c93acfd0d2",
"geoLocation": {
"country": "US",
"code": "",
"r1": "California",
"r2": "San Francisco"
}
}
- Korea, ext=t, xml
<getLocationResponse>
<requestId>c4e52003-7879-4216-8eb5-66c93acfd0d2</requestId>
<returnCode>0</returnCode>
<geoLocation>
<country>KR</country>
<code>4113558000</code>
<r1>경기도</r1>
<r2>성남시 분당구</r2>
<r3>서현1동</r3>
<lat>37.3829030</lat>
<long>127.126290</long>
<net>Korea Net</net>
</geoLocation>
</getLocationResponse>
- Korea, ext=t, json
{
"returnCode": 0,
"requestId": "c4e52003-7879-4216-8eb5-66c93acfd0d2",
"geoLocation": {
"country": "KR",
"code": "4113558000",
"r1": "경기도",
"r2": "성남시 분당구",
"r3": "서현1동",
"lat": 37.3829030,
"long": 127.126290,
"net": "Korea Net"
}
}
- Outside of Korea, ext=t, xml
<getLocationResponse>
<requestId>c4e52003-7879-4216-8eb5-66c93acfd0d2</requestId>
<returnCode>0</returnCode>
<geoLocation>
<country>US</country>
<code/>
<r1>California</r1>
<r2>San Francisco</r2>
<r3></r3>
<lat>37.769700</lat>
<long>-122.393300</long>
<net>Fastly</net>
</geoLocation>
</getLocationResponse>
- Outside of Korea, ext=t, json
{
"returnCode": 0,
"requestId": "c4e52003-7879-4216-8eb5-66c93acfd0d2",
"geoLocation": {
"country": "US",
"code": "",
"r1": "California",
"r2": "San Francisco",
"r3": "",
"lat": 37.769700,
"long": -122.393300,
"net": "Fastly"
}
}
Error Codes
Error code | Response message | Description |
---|---|---|
131000 | No Entry | This error occurs when geolocation information that matches the requested IP address is not found. Try again with another IP address. |
131001 | Invalid IP | This error occurs when the requested IP address is not a public IP address or is invalid. For information on the valid IP address format, refer to IPv4 - Wikipedia. |
131002 | Internal Server Error | This error occurs due to internal errors of the GeoLocation server. If the problem persists, Support > Contact Us. |
131003 | Quota Limit Reached | This error occurs when the number of API calls reaches the defined quota limit. Go to NAVER Cloud Platform’s console, and click GeoLocation > Quota Setting to change the quota. |
131004 | Subscription Required | Go to NAVER Cloud Platform’s console, and click GeoLocation > Subscription to request the GeoLocation service. |
For other response codes, refer to NAVER Cloud Platform > Error handling.
Sample Example
Was this article helpful?