SDKs overview

Disify provides an API designed for real-time email validation and the detection of disposable email addresses. To facilitate integration, Disify offers official Software Development Kits (SDKs) and supports community-contributed libraries. These SDKs encapsulate the underlying HTTP requests, allowing developers to interact with the Disify API using native language constructs rather than direct HTTP client management. This approach aims to streamline development, reduce boilerplate code, and improve maintainability when implementing email validation features in various applications.

The core functionality accessible through these SDKs includes querying an email address to determine its validity, identifying if it belongs to a disposable email provider, and retrieving additional information such as domain details and a suggested correction for common typos. Integrating an SDK typically involves installing a package via a language-specific package manager, configuring it with an API key, and then calling specific methods to perform validation checks. Disify's developer experience notes highlight that the API is straightforward to integrate, with documentation that includes code examples in several popular languages, aiding in quick initial setup Disify API documentation.

While SDKs simplify API interactions, developers can also choose to interact with the Disify API directly using any HTTP client if an SDK for their preferred language is not available or if they require more granular control over HTTP requests. The API adheres to RESTful principles, accepting JSON payloads and returning JSON responses, which is a common pattern in web service development W3C REST architecture guidance.

Official SDKs by language

Disify maintains official SDKs for several programming languages, designed to provide a consistent and idiomatic interface for its API. These SDKs are typically found in their respective language's package repositories and are kept up-to-date with API changes. The following table summarizes the key official SDKs:

Language Package/Library Name Install Command Example Maturity/Status
Node.js disify-nodejs npm install disify-nodejs Stable
Python disify-python pip install disify-python Stable
PHP disify-php composer require disify/disify-php Stable
Ruby disify-ruby gem install disify-ruby Stable
Go go-disify go get github.com/disify/go-disify Stable
Java disify-java Maven/Gradle dependency in pom.xml/build.gradle Stable
C# Disify.NET dotnet add package Disify.NET Stable

Each official SDK aims to reflect the API's capabilities fully, including email validation, disposable email detection, and error handling. Developers are encouraged to refer to the specific documentation for each SDK for detailed usage instructions and method signatures Disify developer guide.

Installation

Installation procedures for Disify SDKs follow the standard practices for each programming ecosystem. Below are general instructions and examples for common languages. Before installation, developers typically need to obtain an API key from their Disify account, which will be used to authenticate requests.

Node.js

To install the Node.js SDK, use npm or yarn:

npm install disify-nodejs
# or
yarn add disify-nodejs

Python

Install the Python SDK using pip:

pip install disify-python

PHP

For PHP, Composer is the standard package manager:

composer require disify/disify-php

Ruby

RubyGems is used to install the Ruby SDK:

gem install disify-ruby

Go

Go modules are used for managing dependencies:

go get github.com/disify/go-disify

Java

For Java projects, you would typically add a dependency to your pom.xml (Maven) or build.gradle (Gradle) file. Example for Maven:

<dependency>
    <groupId>com.disify</groupId>
    <artifactId>disify-java</artifactId>
    <version>1.0.0</version> <!-- Use the latest version -->
</dependency>

C# (.NET)

The C# SDK can be installed via NuGet:

dotnet add package Disify.NET
# or from Package Manager Console
Install-Package Disify.NET

After installation, the SDKs generally require initialization with your Disify API key to authenticate requests. This key ensures that your usage is tracked against your account and that you can access the service according to your plan Disify pricing details.

Quickstart example

This section provides a quickstart example demonstrating how to use the Disify API via one of its official SDKs to validate an email address. The example uses the Python SDK.

Python Quickstart

First, ensure you have installed the disify-python package as described in the installation section.

import os
from disify import Disify

# Replace with your actual Disify API key or set as environment variable
# It's recommended to use environment variables for API keys in production
api_key = os.environ.get("DISIFY_API_KEY", "YOUR_DISIFY_API_KEY")

# Initialize the Disify client
disify_client = Disify(api_key)

def validate_email_address(email):
    try:
        response = disify_client.check(email)
        if response.get("format") and response.get("disposable") is False and response.get("dns") and response.get("smtp"):
            print(f"Email '{email}' is valid and not disposable.")
            print(f"Details: {response}")
        elif response.get("disposable") is True:
            print(f"Email '{email}' is a disposable email address.")
            print(f"Details: {response}")
        else:
            print(f"Email '{email}' is invalid or has issues.")
            print(f"Details: {response}")
    except Exception as e:
        print(f"An error occurred: {e}")

# Example usage
validate_email_address("[email protected]")
validate_email_address("invalid-email")
validate_email_address("[email protected]") # Example disposable email

This Python example initializes the Disify client with an API key and then calls the check method to validate an email address. The response object contains various fields, including format (boolean, indicating correct syntax), disposable (boolean, indicating if it's a disposable email), dns (boolean, indicating valid DNS records), and smtp (boolean, indicating SMTP server availability). Handling of the API key via an environment variable is a common security practice for managing credentials in applications Google API client key management.

Community libraries

In addition to the official SDKs, the broader developer community may contribute libraries or integrations for Disify. These community-driven projects can offer support for languages not covered by official SDKs, provide alternative abstractions, or integrate Disify's functionality into specific frameworks or platforms. While official SDKs are maintained by Disify, community libraries are supported by their respective creators and users.

Developers seeking a community library should verify its active maintenance, compatibility with the latest Disify API version, and overall quality. Resources like GitHub, package managers for various languages (e.g., npm, PyPI, Packagist), and developer forums are common places to discover such contributions. Before relying on a community library for production applications, it is advisable to review its source code and documentation, and potentially conduct tests to ensure it meets project requirements and security standards. Disify's official documentation provides the canonical reference for API behavior, which can be used to evaluate community implementations Disify API reference.

As of the current date, specific widely adopted community libraries for Disify are not prominently featured on their official documentation, suggesting that the official SDKs serve the primary needs of most developers. However, the open nature of RESTful APIs means that any language with HTTP client capabilities can interact with Disify, fostering potential for future community contributions.