json IP-数据的OpenAPI
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了json IP-数据的OpenAPI相关的知识,希望对你有一定的参考价值。
{
"swagger": "2.0",
"info": {
"version": "2017-09-05T19:26:55Z",
"title": "ipdata.co",
"description": "**Please note that our new endpoint is https://api.ipdata.co** <br><br> [ipdata.co](https://ipdata.co) provides a free IP geolocation service, with the following data points; Country, Region, City, Latitude and Longitude, Organistion or ISP and Timezone. <br/> <br> The free tier provides for 1500 requests/day, with no sign up or API keys.<br><br> Visit <a href='https://ipdata.co/#pricing'>ipdata.co</a> to view plans if you need to make more requests. <br/><br/>**Please note that the examples you run here will return the results for the calling ip, which in this case will be the apiary servers. This may be good enough for a quick test. However, to run these examples and get your own ip's data then copy over the code and run it locally.**<br/><br /> To use an API key, add it as a query or header parameter with the name `api-key` <br> <h3>Libraries</h3> *_Python:_* https://pypi.python.org/pypi/ipdata/1.6 <br><br> Install with <br><br> `pip install ipdata` <br><br><h3>Example</h3> <br><h5>Query Parameter</h5> <br> ```curl https://api.ipdata.co/4.4.8.4?api-key=<api key>``` <br> <br> <h5>As a Header</h5> ```curl --header 'api-key : <api key>' https://api.ipdata.co/4.4.8.4``` <br> <br>For support, send an email to [support@ipdata.co](mailto:support@ipdata.co).",
"contact": {
"name": "API Support",
"email": "jonathan@saharacluster.com"
}
},
"host": "api.ipdata.co",
"schemes": [
"https"
],
"paths": {
"/": {
"get": {
"description": "Lookup the details of your calling IP address.",
"produces": [
"application/json"
],
"parameters": [
{
"name": "callback",
"in": "query",
"required": false,
"type": "string"
}
],
"responses": {
"200": {
"description": "200 response",
"schema": {
"$ref": "#/definitions/ip"
}
}
}
}
},
"/{ip}": {
"get": {
"description": "Lookup the country, region, city, lat/long, owning organisation, postal code and timezone of your IP address.",
"produces": [
"application/json"
],
"parameters": [
{
"name": "callback",
"in": "query",
"required": false,
"type": "string"
},
{
"name": "ip",
"in": "path",
"required": true,
"type": "string"
}
],
"responses": {
"200": {
"description": "200 response",
"schema": {
"$ref": "#/definitions/Empty"
}
}
}
}
},
"/{ip}/{language}": {
"get": {
"description": "Get the country and region names in 6 languages, including English (en), German (de), Spanish (es), Russian (ru), Japanese (ja) and Simplified Chinese (zh-CN).",
"produces": [
"application/json"
],
"parameters": [
{
"name": "language",
"in": "path",
"required": true,
"type": "string"
},
{
"name": "callback",
"in": "query",
"required": false,
"type": "string"
},
{
"name": "ip",
"in": "path",
"required": true,
"type": "string"
}
],
"responses": {
"200": {
"description": "200 response",
"schema": {
"$ref": "#/definitions/Empty"
}
}
}
}
}
},
"definitions": {
"Empty": {
"type": "object",
"title": "Empty Schema"
},
"ip": {
"type": "object",
"properties": {
"city": {
"type": "string"
},
"country_code": {
"type": "string"
},
"country_name": {
"type": "string"
},
"ip": {
"type": "string"
},
"location": {
"type": "string"
},
"organisation": {
"type": "string"
},
"postal": {
"type": "string"
},
"region": {
"type": "string"
},
"time_zone": {
"type": "string"
}
},
"title": "IP INFO"
}
}
}
以上是关于json IP-数据的OpenAPI的主要内容,如果未能解决你的问题,请参考以下文章