SDKs overview
US Extract provides Software Development Kits (SDKs) and client libraries designed to facilitate integration with its various data validation APIs, including Address Validation, Email Validation, Phone Validation, and Name Validation APIs. These SDKs abstract the underlying RESTful API calls and JSON response parsing, allowing developers to interact with US Extract services using native language constructs. The availability of SDKs across multiple programming languages aims to reduce development time and potential integration errors by providing pre-packaged functions for common tasks such as sending validation requests and processing the returned data.
The core functionality exposed through these SDKs typically includes methods for:
- Address Validation: Standardizing, correcting, and appending missing information to postal addresses. This often involves geocoding data and identifying residential versus commercial addresses, as detailed in the US Extract Address Validation API reference.
- Email Validation: Verifying the deliverability and legitimacy of email addresses, helping to reduce bounce rates and prevent fraud.
- Phone Validation: Confirming the validity and type (e.g., mobile, landline) of phone numbers, including carrier information.
- Name Validation: Assessing the probability of a name being real and correctly formatted.
Developers can find comprehensive guides and examples for each SDK within the US Extract official documentation, which covers setup, authentication, and usage patterns for different validation scenarios. The SDKs are maintained to reflect the latest API versions and best practices for secure and efficient data exchange.
Official SDKs by language
US Extract offers official SDKs for several popular programming languages, ensuring broad compatibility for developers. These SDKs are developed and maintained by US Extract to guarantee adherence to API specifications and provide a consistent developer experience. Each SDK includes functionalities tailored to the respective language's conventions, simplifying the process of making API calls and handling responses. The official SDKs are the recommended method for integrating US Extract services into new and existing applications due to their direct support and maintenance status.
The following table outlines the officially supported SDKs, their typical package names, and standard installation commands:
| Language | Package Name (Typical) | Installation Command (Example) | Maturity |
|---|---|---|---|
| Python | usextract-python |
pip install usextract-python |
Stable |
| Node.js | @usextract/node |
npm install @usextract/node |
Stable |
| PHP | usextract/php-sdk |
composer require usextract/php-sdk |
Stable |
| Ruby | usextract-ruby |
gem install usextract-ruby |
Stable |
| Java | usextract-java |
(Maven/Gradle dependency) | Stable |
| .NET | Usextract.Net |
dotnet add package Usextract.Net |
Stable |
For detailed instructions on incorporating these SDKs into specific project types (e.g., Maven projects for Java, NuGet for .NET), developers should consult the US Extract developer documentation. Each SDK typically requires an API key for authentication, which is typically passed during client initialization or via environment variables. The architecture of these SDKs often follows a client-server model, where the SDK acts as a client library facilitating communication with the remote US Extract API servers.
Installation
Installing a US Extract SDK generally follows the standard package management practices for each respective programming language. The process typically involves using a command-line tool to add the SDK package to a project's dependencies.
Python
For Python projects, the pip package installer is used. Ensure you have Python and pip installed. The recommended approach is to install the SDK within a virtual environment to manage dependencies effectively, as described in the Python virtual environments tutorial.
python -m venv venv
source venv/bin/activate # On Windows use `venv\Scripts\activate`
pip install usextract-python
Node.js
Node.js developers typically use npm (Node Package Manager) or yarn to install packages.
npm install @usextract/node
# or
yarn add @usextract/node
PHP
PHP projects commonly use Composer for dependency management. If Composer is not already installed, instructions are available on the Composer download page.
composer require usextract/php-sdk
Ruby
Ruby projects use RubyGems. The gem command installs the SDK.
gem install usextract-ruby
Java
Java projects typically manage dependencies using Maven or Gradle. The US Extract Java SDK can be added to your pom.xml (Maven) or build.gradle (Gradle) file.
Maven (pom.xml)
<dependencies>
<dependency>
<groupId>com.usextract</groupId>
<artifactId>usextract-java</artifactId>
<version>1.0.0</version> <!-- Check official docs for latest version -->
</dependency>
</dependencies>
Gradle (build.gradle)
dependencies {
implementation 'com.usextract:usextract-java:1.0.0' // Check official docs for latest version
}
.NET
.NET developers use the NuGet package manager. The SDK can be installed via the .NET CLI or the NuGet Package Manager Console in Visual Studio.
dotnet add package Usextract.Net
# or via Package Manager Console in Visual Studio
Install-Package Usextract.Net
After installation, the SDK client typically needs to be initialized with your API key, which can be obtained from your US Extract account dashboard.
Quickstart example
This section provides a quickstart example using the US Extract Python SDK to perform an address validation. The example demonstrates the basic steps: client initialization, making a validation call, and processing the response. For a more complete overview of the Python SDK capabilities, consult the US Extract Python SDK documentation.
Python Address Validation Example
This Python snippet demonstrates how to validate a single address. Replace YOUR_API_KEY with your actual US Extract API key.
import os
from usextract_python import US_Extract_Client
# Initialize the client with your API Key
# It's recommended to load your API key from environment variables
api_key = os.environ.get("US_EXTRACT_API_KEY", "YOUR_API_KEY")
client = US_Extract_Client(api_key=api_key)
try:
# Define the address to validate
address_to_validate = {
"street": "1600 Amphitheatre Pkwy",
"city": "Mountain View",
"state": "CA",
"zip_code": "94043"
}
# Perform address validation
print(f"Validating address: {address_to_validate}")
validation_response = client.address.validate(address_to_validate)
# Process the response
if validation_response.is_valid:
print("Address is valid.")
print(f"Formatted Address: {validation_response.formatted_address}")
print(f"Components: {validation_response.components}")
print(f"Metadata: {validation_response.metadata}")
else:
print("Address is invalid or has issues.")
print(f"Errors: {validation_response.errors}")
print(f"Suggestions: {validation_response.suggestions}")
except Exception as e:
print(f"An error occurred: {e}")
This example initializes the US_Extract_Client with an API key, then calls the address.validate method with a dictionary representing the address. The response object, validation_response, provides properties like is_valid, formatted_address, components, and errors to programmatically access the validation results. For production environments, it is best practice to manage API keys securely, often through environment variables or a dedicated secret management system, as advised by security best practices such as those outlined in Google Cloud API key best practices.
Community libraries
While US Extract provides a suite of official SDKs, the developer community may also contribute open-source client libraries or wrappers for additional languages or specific frameworks. These community-driven projects can offer alternative integration approaches or specialized functionalities not present in the official SDKs. Community libraries are typically hosted on platforms like GitHub and distributed via language-specific package managers.
Developers considering community libraries should exercise due diligence, as these libraries may not carry the same level of support, maintenance, or security guarantees as official SDKs. It is advisable to:
- Check Project Activity: Verify the last commit date, issue tracker activity, and contributor engagement to assess ongoing maintenance.
- Review Documentation: Ensure the library has clear and comprehensive documentation for installation and usage.
- Examine Source Code: Inspect the code for adherence to best practices, security considerations, and alignment with US Extract's API specifications.
- Test Thoroughly: Rigorously test the library in your specific environment and use cases before deploying to production.
- Verify Licensing: Understand the open-source license under which the library is distributed.
As of the current date, US Extract's official documentation primarily focuses on its first-party SDKs. Developers interested in finding community-contributed libraries should search relevant package repositories (e.g., PyPI for Python, npm for Node.js, Packagist for PHP, RubyGems for Ruby, Maven Central for Java, NuGet for .NET) or code-hosting platforms using keywords like "US Extract", "address validation", and the specific programming language or framework. The US Extract developer community forums, if available, can also be a resource for discovering and discussing third-party integrations.