IP Geolocation - ip查询

The API base path is
http://ip-api.com/json/{query}

{query}可以是单个 IPv4/IPv6 地址或域名。如果您不提供查询,则将使用当前 IP 地址。

fieldsresponse fields optional(fields=status,message,query,country,city)
langresponse language optional
callbackwrap inside (JSONP) optional

e.g:http://ip-api.com/json/24.48.0.1?fields=61439&lang=zh-CN

response

{
  "query": "24.48.0.1",
  "status": "success",
  "country": "加拿大",
  "countryCode": "CA",
  "region": "QC",
  "regionName": "Quebec",
  "city": "蒙特利尔",
  "zip": "H1K",
  "lat": 45.6085,
  "lon": -73.5493,
  "timezone": "America/Toronto",
  "isp": "Le Groupe Videotron Ltee",
  "org": "Videotron Ltee",
  "as": "AS5769 Videotron Telecom Ltee"
}

statussuccess or failsuccessstring
messageincluded only when status is fail
Can be one of the following: private rangereserved range, invalid query
invalid querystring
continentContinent nameNorth Americastring
continentCodeTwo-letter continent codeNAstring
countryCountry nameUnited Statesstring
countryCodeTwo-letter country code ISO 3166-1 alpha-2USstring
regionRegion/state short code (FIPS or ISO)CA or 10string
regionNameRegion/stateCaliforniastring
cityCityMountain Viewstring
districtDistrict (subdivision of city)Old Farm Districtstring
zipZip code94043string
latLatitude37.4192float
lonLongitude-122.0574float
timezoneTimezone (tz)America/Los_Angelesstring
offsetTimezone UTC DST offset in seconds-25200int
currencyNational currencyUSDstring
ispISP nameGooglestring
orgOrganization nameGooglestring
asAS number and organization, separated by space (RIR). Empty for IP blocks not being announced in BGP tables.AS15169 Google Inc.string
asnameAS name (RIR). Empty for IP blocks not being announced in BGP tables.GOOGLEstring
reverseReverse DNS of the IP (can delay response)wi-in-f94.1e100.netstring
mobileMobile (cellular) connectiontruebool
proxyProxy, VPN or Tor exit addresstruebool
hostingHosting, colocated or data centertruebool
queryIP used for the query173.194.67.94string
http://ip-api.com/json/{query}?fields=status,message,country,countryCode,region,regionName,city,zip,lat,lon,timezone,isp,org,as,query

Localization

 

Localized cityregionName and country can be requested by setting the GET parameter lang to one of the following:

enDEMOEnglish (default)
deDEMODeutsch (German)
esDEMOEspañol (Spanish)
pt-BRDEMOPortuguês - Brasil (Portuguese)
frDEMOFrançais (French)
jaDEMO日本語 (Japanese)
zh-CNDEMO中国 (Chinese)
ruDEMOРусский (Russian)
 

Usage limits

This endpoint is limited to 45 requests per minute from an IP address.

If you go over the limit your requests will be throttled (HTTP 429) until your rate limit window is reset. If you constantly go over the limit your IP address will be banned for 1 hour.

The returned HTTP header X-Rl contains the number of requests remaining in the current rate limit window. X-Ttl contains the seconds until the limit is reset.
Your implementation should always check the value of the X-Rl header, and if its is 0 you must not send any more requests for the duration of X-Ttl in seconds.


                
  • 20
    点赞
  • 25
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

zpweiai

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值