GET STARTED
基本エンドポイント
認証なしのGETリクエストで利用できます。JSONとXMLはCORSに対応しているため、クライアントから直接呼び出せます。
JSONレスポンス例
{
"result": true,
"ip": "203.0.113.10",
"version": "IPv4",
"country_code": null,
"country_name": {}
}
サーバーにCloudflareの国ヘッダーまたはGeoIPモジュールが設定されている場合、country_codeとcountry_nameも返されます。
ブラウザから呼び出す
fetch('https://myip.aicodelab.co.kr/api/json/')
.then(response => response.json())
.then(data => console.log(data.ip));