SDKs overview

Gazette Data, UK offers Software Development Kits (SDKs) to facilitate interaction with its API, which provides access to various public notices such as insolvency, probate, and Companies House data. These SDKs are designed to abstract the underlying HTTP requests and response parsing, allowing developers to integrate Gazette Data services into their applications with less boilerplate code. The primary goal of these libraries is to simplify data retrieval and management, enabling developers to focus on application logic rather than API communication specifics. The official SDKs support popular programming languages, ensuring broader accessibility for developers working across different technology stacks.

The developer experience with Gazette Data, UK is supported by comprehensive API documentation and clear examples, which guide users through common integration scenarios. This includes detailed explanations of endpoints, request parameters, and response structures, complementing the functionality provided by the SDKs. For a full understanding of the available data and API capabilities, developers can consult the Gazette Data API reference documentation.

Official SDKs by language

Gazette Data, UK provides official SDKs for Python and Node.js, which are maintained by the Gazette Data development team. These SDKs are designed to offer a consistent and reliable interface for accessing the API across different programming environments. Each SDK is typically distributed through its respective language's package manager, simplifying the installation and dependency management process for developers.

The SDKs encapsulate functionalities such as authentication, request construction, error handling, and response deserialization. This reduces the amount of custom code developers need to write to interact with the Gazette Data API. For instance, common operations like searching for specific notice types or retrieving detailed notice information are exposed through high-level functions within the SDKs.

Official SDKs Table

Language Package Name Install Command Maturity
Python gazette-data-python pip install gazette-data-python Stable
Node.js @gazette-data/nodejs-sdk npm install @gazette-data/nodejs-sdk Stable

Installation

Installing the Gazette Data, UK SDKs involves using the standard package managers for Python and Node.js. These commands retrieve the latest stable version of the SDK from the respective repositories and make it available for use in your project. It is recommended to install SDKs within a virtual environment for Python projects to manage dependencies effectively, and locally for Node.js projects.

Python SDK Installation

To install the Python SDK, use pip, the Python package installer. First, ensure you have Python and pip installed on your system. It is good practice to create and activate a virtual environment before installation to isolate project dependencies. For example, using venv:

python3 -m venv .venv
source .venv/bin/activate
pip install gazette-data-python

This command downloads the gazette-data-python package and its dependencies from the Python Package Index (PyPI). For further details on Python package management, refer to the official Python documentation on installing packages.

Node.js SDK Installation

For Node.js projects, the SDK is available via npm, the Node.js package manager. Ensure Node.js and npm are installed. Navigate to your project directory and run the following command:

npm install @gazette-data/nodejs-sdk

This command adds @gazette-data/nodejs-sdk to your project's node_modules directory and updates your package.json file. For more information on npm package installation, consult the npm install command documentation.

Quickstart example

These quickstart examples demonstrate basic usage of the Gazette Data SDKs to retrieve data. Before running these examples, ensure you have obtained an API key from your Gazette Data, UK account, as it is required for authentication.

Python Quickstart

This Python example shows how to initialize the client and fetch recent insolvency notices. Replace 'YOUR_API_KEY' with your actual API key.

from gazette_data_python import GazetteDataClient

# Initialize the client with your API key
client = GazetteDataClient(api_key='YOUR_API_KEY')

try:
    # Fetch recent insolvency notices
    # The 'limit' parameter restricts the number of results
    # The 'notice_type' parameter specifies the type of notices to retrieve
    insolvency_notices = client.get_notices(notice_type='insolvency', limit=5)

    print("Recent Insolvency Notices:")
    for notice in insolvency_notices:
        print(f"  - ID: {notice['id']}, Title: {notice['title']}, Date: {notice['publication_date']}")

except Exception as e:
    print(f"An error occurred: {e}")

This script initializes the GazetteDataClient, then calls the get_notices method to retrieve a specified number of insolvency notices. The results are then iterated and printed, demonstrating basic data access.

Node.js Quickstart

This Node.js example demonstrates how to use the SDK to retrieve recent probate notices. Replace 'YOUR_API_KEY' with your actual API key.

const { GazetteDataClient } = require('@gazette-data/nodejs-sdk');

async function fetchProbateNotices() {
    // Initialize the client with your API key
    const client = new GazetteDataClient('YOUR_API_KEY');

    try {
        // Fetch recent probate notices
        // The 'limit' parameter restricts the number of results
        // The 'noticeType' parameter specifies the type of notices to retrieve
        const probateNotices = await client.getNotices({ noticeType: 'probate', limit: 5 });

        console.log("Recent Probate Notices:");
        probateNotices.forEach(notice => {
            console.log(`  - ID: ${notice.id}, Title: ${notice.title}, Date: ${notice.publicationDate}`);
        });
    } catch (error) {
        console.error(`An error occurred: ${error.message}`);
    }
}

fetchProbateNotices();

This JavaScript code defines an asynchronous function to initialize the GazetteDataClient and then uses its getNotices method to retrieve probate notices. The fetched data is then logged to the console, illustrating a typical asynchronous API interaction pattern in Node.js.

Community libraries

Currently, Gazette Data, UK primarily focuses on providing and maintaining its official SDKs for Python and Node.js. While there are no officially endorsed community-contributed libraries listed on the Gazette Data documentation, developers may create their own client libraries or wrappers in other languages to interact with the Gazette Data API. These community-driven efforts often arise from specific project needs or preferences for languages not officially supported by an API provider's SDKs.

Developers interested in building a community library or contributing to existing open-source projects related to Gazette Data, UK are encouraged to consult the official API documentation for endpoint specifications, authentication methods, and data models. This ensures compatibility and adherence to the API's operational guidelines. When using or developing community libraries, it is important to verify their maintenance status, security practices, and alignment with the latest API versions, as these are not officially supported or validated by Gazette Data, UK.

For developers working with other programming languages, direct integration with the Gazette Data API using standard HTTP client libraries (e.g., requests in Python, axios or fetch in JavaScript) remains a viable option. This approach requires manual handling of authentication, request construction, and response parsing, but offers maximum flexibility. For example, a developer might use a generic HTTP client to make RESTful API calls, as described in common web API interaction patterns on MDN Web Docs.