Module iptwist
![](https://bcentral-packageicons.azureedge.net/images/ballerinax_iptwist_1.2.0.png)
ballerinax/iptwist Ballerina library
1.2.0
Overview
This is a generated connector from ipTwist API v1 OpenAPI Specification.
ipTwist is a reliable, secure, and simple IP geolocation API. More about the ipTwist API can be find at https://iptwist.com/documentation
This module supports ipTwist API version v1.
Prerequisites
Before using this connector in your Ballerina application, complete the following:
- Create ipTwist account
- Obtain tokens - Navigate to the ipTwist Settings, your API key will be listed there, simply copy it.
Quickstart
To use the ipTwist connector in your Ballerina application, update the .bal file as follows:
Step 1: Import connector
First, import the ballerinax/iptwist module into the Ballerina project.
import ballerinax/iptwist;
Step 2: Create a new connector instance
You can now intantiate the client.
iptwist:ApiKeysConfig apiKeyConfig = { xIptwistToken: "<API Token>" }; iptwist:Client iptwistClient = check new(apiKeyConfig);
Step 3: Invoke an operation
- Now you can use the operations available within the connector. Following code demonstrate how to check for ip geolocation info.
Request req = { ip: "112.134.242.92" }; bintable:Response geoLocationInfo = check baseClient->getGeoLocationInfo(req);
- Use
bal run
command to compile and run the Ballerina program.