SDKs overview

ipfind.io offers a RESTful API for IP geolocation, providing developers with programmatic access to location data based on an IP address. To facilitate integration, ipfind.io provides official Software Development Kits (SDKs) and supports community-contributed libraries. These SDKs are designed to streamline the process of making API calls, handling authentication, and parsing JSON responses, abstracting the underlying HTTP communication protocols, as defined by the IETF's HTTP/1.1 Message Syntax and Routing specification. This approach allows developers to focus on application logic rather than low-level API interaction details.

The official SDKs are developed and maintained by ipfind.io to ensure compatibility and leverage the API's features effectively. They typically include methods for common operations like looking up an IP address, handling API keys, and managing potential errors. Community libraries, while not officially supported, can offer additional language support or specialized functionalities developed by the broader developer ecosystem.

Official SDKs by language

ipfind.io provides official SDKs for several popular programming languages, allowing developers to integrate IP geolocation capabilities directly into their applications. These SDKs are designed to simplify API calls and response handling. The following table outlines the officially supported SDKs, their respective package managers, installation commands, and maturity status:

Language Package Manager Installation Command Maturity
PHP Composer composer require ipfind/ipfind Stable
Node.js npm npm install ipfind Stable
Python pip pip install ipfind Stable
Ruby RubyGems gem install ipfind Stable
Go Go Modules go get github.com/ipfind/go-ipfind Stable

Each SDK is documented with specific usage examples and API call structures on the official ipfind.io documentation page, ensuring developers have the necessary resources for integration.

Installation

Installing an ipfind.io SDK typically involves using the standard package manager for the chosen programming language. The following sections provide common installation instructions.

PHP

For PHP projects, Composer is the recommended dependency manager. To install the ipfind.io PHP SDK:

composer require ipfind/ipfind

After installation, include Composer's autoloader in your project to use the SDK classes:

require 'vendor/autoload.php';

Node.js

Node.js applications use npm (Node Package Manager) for package installation. To add the ipfind.io Node.js SDK:

npm install ipfind

Alternatively, if you use Yarn:

yarn add ipfind

Python

Python developers typically use pip to install packages. To install the ipfind.io Python SDK:

pip install ipfind

It is often recommended to install packages within a Python virtual environment to manage project-specific dependencies.

Ruby

For Ruby applications, RubyGems is the standard package manager. To install the ipfind.io Ruby gem:

gem install ipfind

Then, require the gem in your Ruby script:

require 'ipfind'

Go

Go projects utilize Go Modules for dependency management. To fetch the ipfind.io Go SDK:

go get github.com/ipfind/go-ipfind

After running go get, the module will be added to your go.mod file, and you can import it into your Go source code.

Quickstart example

This section provides quickstart code examples for using the ipfind.io SDKs to perform a basic IP geolocation lookup. Replace YOUR_API_KEY with your actual ipfind.io API key, which can be obtained from your ipfind.io account dashboard.

PHP Quickstart

<?php
require 'vendor/autoload.php';

use IpFind\IpFind;

$apiKey = 'YOUR_API_KEY';
$ipfind = new IpFind($apiKey);

try {
    $ipAddress = '8.8.8.8'; // Example IP address (Google DNS)
    $result = $ipfind->address($ipAddress);
    
    echo "IP Address: " . $result->ipAddress . "\n";
    echo "Country: " . $result->country . "\n";
    echo "City: " . $result->city . "\n";
    echo "Latitude: " . $result->latitude . "\n";
    echo "Longitude: " . $result->longitude . "\n";
} catch (Exception $e) {
    echo 'Error: ' . $e->getMessage();
}
?>

Node.js Quickstart

const IpFind = require('ipfind');

const apiKey = 'YOUR_API_KEY';
const ipfind = new IpFind(apiKey);

const ipAddress = '8.8.8.8'; // Example IP address (Google DNS)

ipfind.address(ipAddress)
  .then(result => {
    console.log(`IP Address: ${result.ipAddress}`);
    console.log(`Country: ${result.country}`);
    console.log(`City: ${result.city}`);
    console.log(`Latitude: ${result.latitude}`);
    console.log(`Longitude: ${result.longitude}`);
  })
  .catch(error => {
    console.error('Error:', error.message);
  });

Python Quickstart

from ipfind import IpFind

api_key = 'YOUR_API_KEY'
ipfind = IpFind(api_key)

ip_address = '8.8.8.8'  # Example IP address (Google DNS)

try:
    result = ipfind.address(ip_address)
    print(f"IP Address: {result['ipAddress']}")
    print(f"Country: {result['country']}")
    print(f"City: {result['city']}")
    print(f"Latitude: {result['latitude']}")
    print(f"Longitude: {result['longitude']}")
except Exception as e:
    print(f"Error: {e}")

Ruby Quickstart

require 'ipfind'

api_key = 'YOUR_API_KEY'
ipfind = IpFind.new(api_key)

ip_address = '8.8.8.8' # Example IP address (Google DNS)

begin
  result = ipfind.address(ip_address)
  puts "IP Address: #{result['ipAddress']}"
  puts "Country: #{result['country']}"
  puts "City: #{result['city']}"
  puts "Latitude: #{result['latitude']}"
  puts "Longitude: #{result['longitude']}"
rescue StandardError => e
  puts "Error: #{e.message}"
end

Go Quickstart

package main

import (
	"context"
	"fmt"
	"log"

	ipfind "github.com/ipfind/go-ipfind"
)

func main() {
	apiKey := "YOUR_API_KEY"
	client := ipfind.NewClient(apiKey)

	ipAddress := "8.8.8.8" // Example IP address (Google DNS)

	ctx := context.Background()
	result, _, err := client.Address.Get(ctx, ipAddress)
	if err != nil {
		log.Fatalf("Error getting IP address: %v", err)
	}

	fmt.Printf("IP Address: %s\n", result.IPAddress)
	fmt.Printf("Country: %s\n", result.Country)
	fmt.Printf("City: %s\n", result.City)
	fmt.Printf("Latitude: %f\n", result.Latitude)
	fmt.Printf("Longitude: %f\n", result.Longitude)
}

Community libraries

While ipfind.io maintains official SDKs for key languages, the broader developer community may contribute additional libraries or wrappers that extend functionality or support other programming environments. These community-driven projects can vary in terms of maintenance, features, and adherence to the latest API specifications. Developers considering community libraries should review their source code, documentation, and community activity to assess their suitability for production environments.

Community contributions often emerge to address specific use cases, integrate with particular frameworks, or provide language support not covered by official SDKs. For example, a community library might offer a wrapper for a less common language or provide advanced caching mechanisms. Developers can often find these resources by searching relevant package repositories (e.g., GitHub, PyPI, npm) or through developer forums. Although not officially endorsed, these libraries demonstrate the flexibility and extensibility of the ipfind.io API, allowing for broader adoption and innovation within the developer community.