Skip to content

Commit c7b6446

Browse files
committed
Fix README table of contents, heading level and sample output
The table of contents linked "API" to #create-an-instance, an anchor that does not exist; "Bulk data" was a level-3 heading although it belongs to the API section; the "Basic Usage" sample output predated carrier, is_satellite, is_anycast, languages[].code, threat.is_vpn, threat.blocklists and threat.scores. The sample is now the model serialized from the 1.1.1.1 test fixture, and languages[].code is listed with the other recently added fields. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
1 parent 2036451 commit c7b6446

1 file changed

Lines changed: 49 additions & 30 deletions

File tree

‎README.md‎

Lines changed: 49 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ An 100% compliant [ipdata.co](https://ipdata.co) API java client.
99
- [Install](#install)
1010
- [Use](#use)
1111
- [Configuration](#configuration)
12-
- [API](#create-an-instance)
12+
- [API](#api)
1313
- [Basic Usage](#basic-usage)
1414
- [Connection reuse and HTTP/2](#connection-reuse-and-http2)
1515
- [Single Field Selection](#single-field-selection)
@@ -81,66 +81,84 @@ Output:
8181
{
8282
"ip": "1.1.1.1",
8383
"is_eu": false,
84-
"city": null,
85-
"region": null,
86-
"region_code": null,
87-
"region_type": null,
88-
"country_name": "Australia",
89-
"country_code": "AU",
90-
"continent_name": "Oceania",
91-
"continent_code": "OC",
92-
"latitude": -33.494,
93-
"longitude": 143.2104,
94-
"postal": null,
95-
"calling_code": "61",
96-
"flag": "https://ipdata.co/flags/au.png",
97-
"emoji_flag": "\ud83c\udde6\ud83c\uddfa",
98-
"emoji_unicode": "U+1F1E6 U+1F1FA",
84+
"is_satellite": false,
85+
"is_anycast": false,
86+
"city": "Los Angeles",
87+
"organisation": null,
88+
"region": "California",
89+
"region_code": "CA",
90+
"region_type": "state",
91+
"country_name": "United States",
92+
"country_code": "US",
93+
"continent_name": "North America",
94+
"continent_code": "NA",
95+
"latitude": 34.0522,
96+
"longitude": -118.2437,
97+
"postal": "90001",
98+
"calling_code": "1",
99+
"flag": "https://ipdata.co/flags/us.png",
100+
"emoji_flag": "\ud83c\uddfa\ud83c\uddf8",
101+
"emoji_unicode": "U+1F1FA U+1F1F8",
99102
"asn": {
100103
"asn": "AS13335",
101-
"name": "Cloudflare, Inc.",
104+
"name": "Cloudflare Inc",
102105
"domain": "cloudflare.com",
103106
"route": "1.1.1.0/24",
104107
"type": "hosting"
105108
},
109+
"carrier": {
110+
"name": "Cloudflare",
111+
"mcc": "310",
112+
"mnc": "000"
113+
},
106114
"company": {
107-
"name": "Cloudflare, Inc.",
115+
"name": "Cloudflare Inc",
108116
"domain": "cloudflare.com",
109117
"network": "1.1.1.0/24",
110118
"type": "hosting"
111119
},
112120
"languages": [
113121
{
114122
"name": "English",
115-
"native": "English"
123+
"native": "English",
124+
"code": "en",
125+
"rtl": 0
116126
}
117127
],
118128
"currency": {
119-
"name": "Australian Dollar",
120-
"code": "AUD",
121-
"symbol": "AU$",
129+
"name": "US Dollar",
130+
"code": "USD",
131+
"symbol": "$",
122132
"native": "$",
123-
"plural": "Australian dollars"
133+
"plural": "US dollars"
124134
},
125135
"time_zone": {
126-
"name": "Australia/Sydney",
127-
"abbr": "AEDT",
128-
"offset": "+1100",
136+
"name": "America/Los_Angeles",
137+
"abbr": "PDT",
138+
"offset": "-0700",
129139
"is_dst": true,
130-
"current_time": "2020-01-29T20:22:52.283874+11:00"
140+
"current_time": "2020-06-12T06:37:16.595612-07:00"
131141
},
132142
"threat": {
133143
"is_tor": false,
144+
"is_vpn": false,
134145
"is_proxy": false,
135146
"is_anonymous": false,
136147
"is_known_attacker": false,
137148
"is_known_abuser": false,
138149
"is_threat": false,
139150
"is_bogon": false,
140151
"is_icloud_relay": false,
141-
"is_datacenter": false
152+
"is_datacenter": false,
153+
"blocklists": [],
154+
"scores": {
155+
"vpn_score": 0,
156+
"proxy_score": 0,
157+
"threat_score": 0,
158+
"trust_score": 100
159+
}
142160
},
143-
"count": "0"
161+
"count": "1500"
144162
}
145163
```
146164

@@ -151,6 +169,7 @@ The following fields were added to the API responses recently and are mapped by
151169
- `threat.blocklists[].first_seen` – `Blocklist.getFirstSeen()`: the first day the address was seen on that blocklist, as a `YYYY-MM-DD` (UTC) string, or `null` when the feed does not report it.
152170
- `threat.blocklists[].last_seen` – `Blocklist.getLastSeen()`: the most recent such day, same format, or `null`.
153171
- `threat.blocklists[].days_seen` – `Blocklist.getDaysSeen()`: the number of days the address was seen on that blocklist, as an `Integer`, or `null`.
172+
- `languages[].code` – `Language.code()`: the code of the language (`en` for English), or `null` when the API does not send it.
154173

155174
#### Connection reuse and HTTP/2
156175
An `IpdataService` keeps a persistent HTTPS connection pool for as long as it lives. Create one service per process (or one per API key or endpoint), keep it, and reuse it for every lookup: each new service pays a fresh TLS handshake. Requests to api.ipdata.co are multiplexed over HTTP/2 when the platform negotiates it, and fall back to HTTP/1.1 keep-alive otherwise.
@@ -206,7 +225,7 @@ IpdataModel flags = ipdataService.getFields("1.1.1.1", IpdataField.IS_SATELLITE,
206225

207226
```
208227

209-
### Bulk data
228+
#### Bulk data
210229
You can as well get multiple responses at once by using the ``bulk`` api:
211230

212231
```java

0 commit comments

Comments
 (0)