geoLocation
    • PDF

    geoLocation

    • PDF

    Article Summary

    요청

    API URL

    GET https://geolocation.apigw.ntruss.com/geolocation/v2/geoLocation
    

    요청 헤더

    헤더명설명
    x-ncp-apigw-timestamp1970년 1월 1일 00:00:00 협정 세계시(UTC)부터의 경과 시간을 밀리초(Millisecond)로 나타내며 API Gateway 서버와 시간 차가 5분 이상 나는 경우 유효하지 않은 요청으로 간주
    x-ncp-apigw-timestamp:{Timestamp}
    x-ncp-iam-access-key네이버 클라우드 플랫폼 포털에서 발급받은 Access Key ID 값
    x-ncp-iam-access-key:{Sub Account Access Key}
    x-ncp-apigw-signature-v2Access Key ID 값과 Secret Key로 암호화한 서명
    x-ncp-apigw-signature-v2:{API Gateway Signature}

    요청 파라미터

    파라미터명필수 여부타입제약 사항설명
    ipYStringIPv4 주소 - 위키백과지역 정보를 알고자 하는 사용자 IP
    encNStringutf8(기본값) 또는 euckr응답 결과 인코딩 타입
    extNStringt 또는 f(기본값)추가 정보 포함 여부
    t : 포함
    f : 비포함
    responseFormatTypeNStringxml(기본값) 또는 json응답 결과의 포맷 타입

    응답

    항목타입설명
    requestIdStringAPI 요청 ID
    returnCodeString정상 Code는 0, 이외 오류 코드
    contryString국가코드로서 https://en.wikipedia.org/wiki/ISO_3166
    외에 EU(유럽), AP(아시아, 호주), A1(Anonymous Proxy), A2(Satellite provider), O1(Other Country)를 포함
    codeString한국의 경우에 행정자치부에서 정하는 행정구역 코드를 나타냄
    r1String도, 광역시, 주
    r2String시, 군, 구
    r3String동, 면, 읍
    latNumber위도
    longNumber경도
    netString통신사 이름

    예시

    응답 예시

    • 국내, 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>
    
    • 국내, ext=f, json
    {
    	"returnCode": 0,
    	"requestId": "c4e52003-7879-4216-8eb5-66c93acfd0d2",
    	"geoLocation": {
    		"country": "KR",
    		"code": "4113558000",
    		"r1": "경기도",
    		"r2": "성남시 분당구"
    	}
    }
    
    • 해외, 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>
    
    • 해외, ext=f, json
    {
    	"returnCode": 0,
    	"requestId": "c4e52003-7879-4216-8eb5-66c93acfd0d2",
    	"geoLocation": {
    		"country": "US",
    		"code": "",
    		"r1": "California",
    		"r2": "San Francisco"
    	}
    }
    
    • 국내, 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>
    
    • 국내, 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"
    	}
    }
    
    • 해외, 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>
    
    • 해외, 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"
    	}
    }
    

    오류 코드

    오류 코드응답 메시지설명
    131000No Entry지역 정보를 찾을 수 없는 경우에 발생함. 다른 IP를 이용하여 조회
    131001Invalid IP공인 IP가 아닌 경우거나 IP 주소 형식이 잘못된 경우에 발생함. 정상적인 IP 주소 형식은 IPv4 - 위키백과 참고
    131002Internal Server ErrorGeoLocation 서버의 오류로 발생함. 일시적이 아닌 경우에는 고객지원 > 문의하기를 통해 문의
    131003Quota Limit Reached설정한 Quota 한도만큼 API가 사용됨. 네이버 클라우드 플랫폼 콘솔 > AI·NAVER API > GeoLocation > Quota Setting 메뉴에서 Quota 변경 가능
    131004Subscription Required네이버 클라우드 플랫폼 콘솔 > AI·NAVER API > GeoLocation > Subscription 메뉴에서 이용 신청한 후에 사용

    이 외의 코드값에 대해서는 NAVER Cloud Platform API > 오류 처리하기를 참조해 주십시오.

    예제 파일


    이 문서가 도움이 되었습니까?

    What's Next
    Changing your password will log you out immediately. Use the new password to log back in.
    First name must have atleast 2 characters. Numbers and special characters are not allowed.
    Last name must have atleast 1 characters. Numbers and special characters are not allowed.
    Enter a valid email
    Enter a valid password
    Your profile has been successfully updated.