ip.officialsite.kr API는 클라이언트의 IP 주소와 위치 정보를 JSON 형식으로 제공하는 RESTful API입니다.
GET https://ip.officialsite.kr/api
API는 다음과 같은 JSON 형식으로 응답합니다:
{
"ip_address": "123.456.789.012",
"countryCode": "KR",
"countryName": "대한민국"
}
| 필드명 | 타입 | 설명 |
|---|---|---|
ip_address |
string | 클라이언트의 IP 주소 |
countryCode |
string | ISO 3166-1 alpha-2 국가 코드 (예: KR, US, JP) |
countryName |
string | 국가명 (한국어) |
fetch('https://ip.officialsite.kr/api')
.then(response => response.json())
.then(data => {
console.log('내 IP:', data.ip_address);
console.log('국가:', data.countryName);
})
.catch(error => console.error('Error:', error));
$.getJSON('https://ip.officialsite.kr/api', function(data) {
console.log('내 IP:', data.ip_address);
console.log('국가:', data.countryName);
});
import requests
response = requests.get('https://ip.officialsite.kr/api')
data = response.json()
print(f"내 IP: {data['ip_address']}")
print(f"국가: {data['countryName']}")
curl https://ip.officialsite.kr/api
모든 도메인에서 API 호출이 가능하도록 CORS가 설정되어 있습니다. 웹 브라우저에서 직접 API를 호출할 수 있습니다.
서버 오류 발생 시 HTTP 상태 코드와 함께 오류 메시지가 반환됩니다:
{
"error": "Internal Server Error",
"message": "서버 처리 중 오류가 발생했습니다."
}
API 관련 문의사항이나 기능 요청은 이메일로 연락 주시기 바랍니다.