shammi/ip2locationio

2.0.0

Overview

IP2Location.io REST API allowing users to check IP address location in real time. The REST API supports both IPv4 and IPv6 address lookup. More about the IP2Location.io API can be find at IP2Location.io

Prerequisites

Before using this package in your Ballerina application, complete the following:

Quickstart

To use the IP2Location.io package in your Ballerina application, update the .bal file as follows:

Step 1: Import package

First, import the ip2locationio/ip2locationio module into the Ballerina project.

Copy
import ip2locationio/ip2locationio;

Step 2: Create a new package instance

In your main function, intantiate the client as the following

Copy
public function main() returns error? {
    ip2locationio:Client ip2locationioClient = check new ip2locationio:Client();
    // Your logic here
}

Step 3: Invoke an operation

  1. Now you can use the operations available within the package. Following code demonstrate how to get geolocation information for the IP 8.8.8.8.
Copy
public function main() returns error? {
    ip2locationio:Client ip2locationioClient = check new ip2locationio:Client();
    json|error response = ip2locationioClient->getGeolocationInfo("<YOUR_API_Key>", "8.8.8.8");
    io:println(response);
    // Your logic here
}
  1. Use bal run command to compile and run the Ballerina program.

Import

import shammi/ip2locationio;Copy

Metadata

Released date: 4 months ago

Version: 2.0.0

License: Apache-2.0


Compatibility

Platform: any

Ballerina version: 2201.10.0-SNAPSHOT

GraalVM compatible: Yes


Pull count

Total: 0

Current verison: 0


Weekly downloads


Source repository


Keywords

IT Operations/Cloud Services

Cost/Free


Contributors

Other versions

2.0.0

1.0.0