SDKs overview
Host.io provides Software Development Kits (SDKs) and client libraries designed to facilitate interaction with its suite of domain, IP, and technology data APIs. These SDKs abstract away the complexities of HTTP requests, authentication, and JSON parsing, allowing developers to focus on integrating data into their applications. The official SDKs support popular programming languages, offering idiomatic interfaces for various API endpoints, including the Domain API, Reverse IP API, and Domain Search API.
The SDKs are maintained to reflect the latest API versions and features, ensuring compatibility and access to Host.io's data offerings. Developers can utilize these libraries for tasks such as retrieving detailed domain information, identifying other domains hosted on the same IP address, or searching for domains based on specific criteria. The Host.io API documentation provides comprehensive details on available endpoints and data structures, complementing the SDKs with usage examples and response schemas.
Official SDKs by language
Host.io offers official SDKs for several programming languages, providing structured access to its API endpoints. These libraries are developed to streamline the integration process, handling common tasks such as API key management, request serialization, and response deserialization. The following table outlines the official SDKs, including their respective package names and typical installation methods.
| Language | Package Name | Installation Command | Maturity |
|---|---|---|---|
| Python | hostio-python |
pip install hostio-python |
Stable |
| Go | github.com/host-io/hostio-go |
go get github.com/host-io/hostio-go |
Stable |
| Node.js | hostio-node |
npm install hostio-node |
Stable |
Each SDK is designed to align with the conventions of its respective language, offering an intuitive developer experience. For example, the Python SDK typically uses classes and methods that map directly to API resources and actions, while the Node.js library might leverage asynchronous patterns common in JavaScript development. The Host.io documentation portal provides specific information and examples for each official language binding.
Installation
Installing a Host.io SDK involves using the package manager specific to your chosen programming language. These commands retrieve the library from its respective repository and make it available for use in your project. Ensure you have the correct language runtime and package manager installed before proceeding.
Python
For Python projects, the pip package installer is used to fetch the hostio-python library. It is recommended to install libraries within a virtual environment to manage dependencies effectively. A virtual environment isolates your project's Python dependencies from other projects and the global Python installation.
# Create a virtual environment
python3 -m venv venv
# Activate the virtual environment
# On macOS/Linux:
source venv/bin/activate
# On Windows (Cmd):
vne\Scripts\activate.bat
# On Windows (PowerShell):
vne\Scripts\Activate.ps1
# Install the Python SDK
pip install hostio-python
Go
Go modules are used to manage dependencies in Go projects. The go get command downloads the specified module and adds it to your project's go.mod file. This ensures reproducible builds and dependency management.
# Initialize a Go module for your project if you haven't already
go mod init yourprojectname
# Install the Go SDK
go get github.com/host-io/hostio-go
After running go get, the SDK will be available for import in your Go source files. The module system automatically handles versioning and transitive dependencies.
Node.js
For Node.js applications, the Node Package Manager (npm) is used to install the hostio-node package. This command adds the library to your project's node_modules directory and updates your package.json file.
# Install the Node.js SDK
npm install hostio-node
Alternatively, if you are using Yarn as your package manager, the command would be yarn add hostio-node. Both npm and Yarn manage project dependencies and ensure that all necessary files are downloaded and linked correctly.
Quickstart example
This section provides a basic quickstart example using the Python SDK to retrieve information about a domain. This example demonstrates how to initialize the client with your API key and make a simple API call to the Domain API endpoint. You will need a Host.io API key to run this example, which can be obtained through their free Developer Plan or a paid subscription.
Python Quickstart: Retrieving Domain Data
First, ensure you have installed the Python SDK as described in the installation section. Replace 'YOUR_API_KEY' with your actual Host.io API key.
import os
from hostio import HostioClient
# It's recommended to store your API key as an environment variable
api_key = os.environ.get('HOSTIO_API_KEY', 'YOUR_API_KEY')
if api_key == 'YOUR_API_KEY':
print("Warning: Please replace 'YOUR_API_KEY' or set the HOSTIO_API_KEY environment variable.")
exit()
client = HostioClient(api_key=api_key)
def get_domain_info(domain_name):
try:
# Call the Domain API to get information about a specific domain
domain_data = client.domain.get(domain=domain_name)
print(f"--- Domain Information for {domain_name} ---")
for key, value in domain_data.items():
# Print only top-level keys for brevity; adjust as needed
if isinstance(value, dict):
print(f"{key}: (dict with {len(value)} entries)")
elif isinstance(value, list):
print(f"{key}: (list with {len(value)} entries)")
else:
print(f"{key}: {value}")
print("\n")
except Exception as e:
print(f"Error fetching data for {domain_name}: {e}")
# Example usage:
get_domain_info("example.com")
get_domain_info("host.io")
This script initializes the HostioClient with your API key. It then calls the domain.get() method, passing the target domain name. The returned domain_data dictionary contains various attributes related to the domain, such as its creation date, registrar, nameservers, and associated IP addresses. Developers can parse this dictionary to extract specific pieces of information relevant to their application's needs. For more detailed API usage and available parameters, refer to the Host.io API reference documentation.
Community libraries
While Host.io provides official SDKs for several popular languages, the broader developer community may contribute additional client libraries, wrappers, or tools in other programming languages or frameworks. These community-driven projects can offer alternative integration methods or specialized functionalities not covered by the official SDKs.
Community libraries often emerge to fill gaps for less common languages or to provide specific abstractions that resonate with particular development patterns. Developers interested in contributing or seeking such resources should typically consult platforms like GitHub, GitLab, or language-specific package repositories. Searches on these platforms using terms like "hostio client" or "hostio api wrapper" (e.g., Google Search documentation on site operators) may reveal community-maintained projects. It is important to note that community libraries may not offer the same level of support, maintenance, or feature parity as official SDKs, and their use requires individual assessment of reliability and security practices.
Before integrating any third-party library, it is advisable to review its source code, check its activity on version control platforms, and examine any associated documentation or community discussions. For official support and guaranteed compatibility, the official Host.io documentation and SDKs remain the recommended choice.