ipgeolocation
IP Geolocation API allows developers to get geolocation information for a given IP address.
Usage
import { ipgeolocation } from 'netzo/apis/ipgeolocation.ts'
const {
api,
getLocation
} = ipgeolocation({
apiKey: Deno.env.get('IPGEOLOCATION_API_KEY'),
})
Configuration
The ipgeolocation
factory function expects an object with the following, and returns an object with an API client api
.
Param | Type | Default | Description |
---|---|---|---|
apiKey | string | Deno.env.get('IPGEOLOCATION_API_KEY') | the API key to use for authentication |
Refer to the API documentation to get the required information.
Examples
The following examples assume you have created an api client instance.
Get geolocation
Get geolocation based on provided IP address.
const resultData = await api.ipgeo.get<Geolocation>({ ip: IP_ADDRESS })