IP地理位置API

IP Geolocation API提供免费的地理位置服务,包括IP地址的详细信息如语言、货币等,有助于提升用户体验、分段分析和内容相关性。这个API的URL格式简单,返回信息丰富,如地址格式、电话号码格式和本地化国家名称。此外,API还支持获取国家信息,且它是开源的,允许用户自检代码、运行服务器和贡献代码。
摘要由CSDN通过智能技术生成

Detecting geolocation information from your user provides you a massive advantage: improved conversion, better segmenting and analytics, and providing more relevant content. There are numerous paid services which will provide geolocation info but they're oftentimes too costly or short of valuable information. I was super impressed with IP Geolocation API, a free geolocation API that provides extra details like languages spoken and currency code!

检测来自用户的地理位置信息可为您提供巨大的优势:改进的转换,更好的分段和分析以及提供更多相关的内容。 有许多付费服务可以提供地理位置信息,但是它们往往成本太高或缺乏有价值的信息。 IP Geolocation API给我留下了深刻的印象, IP Geolocation API是一个免费的Geolocation API ,它提供了额外的详细信息,例如说的语言和货币代码!

The URL format for IP Geolocation API is simple:

IP Geolocation API的URL格式很简单:

GET https://api.ipgeolocationapi.com/geolocate/91.213.103.0

The response payload look like:

响应负载如下所示:

{
   "continent":"North America",
   "address_format":"{{recipient}}\n{{street}}\n{{city}} {{region_short}} {{postalcode}}\n{{country}}",
   "alpha2":"US",
   "alpha3":"USA",
   "country_code":"1",
   "international_prefix":"011",
   "ioc":"USA",
   "gec":"US",
   "name":"United States of America",
   "national_destination_code_lengths":[  
      3
   ],
   "national_number_lengths":[  
      10
   ],
   "national_prefix":"1",
   "number":"840",
   "region":"Americas",
   "subregion":"Northern America",
   "world_region":"AMER",
   "un_locode":"US",
   "nationality":"American",
   "postal_code":true,
   "unofficial_names":[
      "United States",
      "Vereinigte Staaten von Amerika",
      "États-Unis",
      "Estados Unidos",
      "アメリカ合衆国",
      "Verenigde Staten"
   ],
   "languages_official":[
      "en"
   ],
   "languages_spoken":[  
      "en"
   ],
   "geo":{  
      "latitude":37.09024,
      "latitude_dec":"39.44325637817383",
      "longitude":-95.712891,
      "longitude_dec":"-98.95733642578125",
      "max_latitude":71.5388001,
      "max_longitude":-66.885417,
      "min_latitude":18.7763,
      "min_longitude":170.5957,
      "bounds":{  
         "northeast":{  
            "lat":71.5388001,
            "lng":-66.885417
         },
         "southwest":{  
            "lat":18.7763,
            "lng":170.5957
         }
      }
   },
   "currency_code":"USD",
   "start_of_week":"sunday"
}

A few bits of extra information I appreciate:

我感谢一些额外的信息:

  • address_format - Not every country formats their addresses the same way, and knowing the address format helps to ensure a delivery gets there

    address_format并非每个国家/地区都以相同的方式设置地址格式,了解地址格式有助于确保送货到达目的地

  • country_code - Useful for phone numbers

    country_code用于电话号码

  • unofficial_names - Useful in getting localized names for a country

    unofficial_names在获取一个国家的本地化名称时很有用

  • languages_official && languages_spoken - Useful for translation purposes.

    languages_official && languages_spoken用于翻译。

In short, you get an incredible amount of information based on IP address!

简而言之,您会获得大量基于IP地址的信息!

IP Geolocation isn't just specific to IPs -- the API also provides an endpoint to get information about countries:

IP地理位置定位不仅限于IP,API还提供了一个端点来获取有关国家/地区的信息:

// https://api.ipgeolocationapi.com/countries/US

{
  "continent": "North America",
  "address_format": "{{recipient}}\n{{street}}\n{{city}} {{region_short}} {{postalcode}}\n{{country}}",
  "alpha2": "US",
  "alpha3": "USA",
  "country_code": "1",
  "international_prefix": "011",
  "ioc": "USA",
  "gec": "US",
  "name": "United States of America",
  "national_destination_code_lengths": [
    3
  ],
  "national_number_lengths": [
    10
  ],
  "national_prefix": "1",
  "number": "840",
  "region": "Americas",
  "subregion": "Northern America",
  "world_region": "AMER",
  "un_locode": "US",
  "nationality": "American",
  "postal_code": true,
  "unofficial_names": [
    "United States",
    "Vereinigte Staaten von Amerika",
    "États-Unis",
    "Estados Unidos",
    "アメリカ合衆国",
    "Verenigde Staten"
  ],
  "languages_official": [
    "en"
  ],
  "languages_spoken": [
    "en"
  ],
  "geo": {
    "latitude": 37.09024,
    "latitude_dec": "39.44325637817383",
    "longitude": -95.712891,
    "longitude_dec": "-98.95733642578125",
    "max_latitude": 71.5388001,
    "max_longitude": -66.885417,
    "min_latitude": 18.7763,
    "min_longitude": 170.5957,
    "bounds": {
      "northeast": {
        "lat": 71.5388001,
        "lng": -66.885417
      },
      "southwest": {
        "lat": 18.7763,
        "lng": 170.5957
      }
    }
  },
  "currency_code": "USD",
  "start_of_week": "sunday"
}

Best of all, IP Geolocation API is open source, so you can inspect the code, run your own server, and even contribute if you wish! Open source FTW!

最重要的是, IP Geolocation API是开源的 ,因此您可以检查代码,运行自己的服务器,甚至可以根据需要提供帮助! 开源FTW!

IP Geolocation API is a very useful tool to help localize, monetize, convert, and provide a great user experience.

IP Geolocation API是一个非常有用的工具,可以帮助本地化,货币化,转换并提供出色的用户体验。

翻译自: https://davidwalsh.name/ip-geolocation-api

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值