SDKs overview

OpenRegistry offers Software Development Kits (SDKs) and client libraries designed to facilitate interaction with its Core API. These SDKs aim to streamline data retrieval and management tasks by providing language-specific abstractions over direct HTTP requests and authentication mechanisms. The availability of official SDKs for multiple programming languages seeks to reduce the development effort required to integrate public government data into various applications and services.

The SDKs are developed and maintained by OpenRegistry, ensuring compatibility with the latest API versions and features. They typically handle common API interaction patterns, such as request signing, error handling, and response parsing, allowing developers to focus on application logic rather than low-level API communication. Beyond official offerings, the open-source nature of many developer ecosystems often results in community-contributed libraries, which can offer alternative approaches or specialized functionality for specific use cases, though these are not formally supported by OpenRegistry.

Official SDKs by language

OpenRegistry provides official SDKs to support developers working in several popular programming environments. These libraries are maintained by OpenRegistry and are the recommended method for interacting with the OpenRegistry platform programmatically. Each SDK is designed to reflect the idioms and conventions of its respective language, aiming for a natural development experience. The primary goal of these SDKs is to abstract the complexities of direct HTTP requests, authentication, and data parsing, providing a higher-level interface for accessing public data sets.

Official OpenRegistry SDKs
Language Package Name Installation Command Maturity
JavaScript/TypeScript @openregistry/client npm install @openregistry/client or yarn add @openregistry/client Stable
Python openregistry-sdk pip install openregistry-sdk Stable
Go github.com/openregistry/go-sdk go get github.com/openregistry/go-sdk Stable
Ruby openregistry-ruby gem install openregistry-ruby Stable

These SDKs are continuously updated to ensure compatibility with the latest OpenRegistry API specifications and to incorporate feedback from the developer community. Comprehensive documentation, including API references and usage examples, is available for each SDK.

Installation

Installing OpenRegistry SDKs involves using the standard package manager for your chosen programming language. This process typically retrieves the library from a central repository and makes it available for import into your project. Prior to installation, ensure your development environment meets the minimum version requirements specified in the OpenRegistry SDK documentation.

JavaScript/TypeScript

For JavaScript and TypeScript projects, the official client can be installed using npm or Yarn. This makes it suitable for both Node.js server-side applications and client-side web applications built with frameworks like React or Vue.

# Using npm
npm install @openregistry/client

# Using Yarn
yarn add @openregistry/client

After installation, you can import modules from @openregistry/client into your JavaScript or TypeScript files. For TypeScript users, type definitions are included with the package, offering enhanced developer experience with autocompletion and type checking.

Python

Python developers can install the openregistry-sdk using pip, the standard Python package installer. This allows for straightforward integration into Python scripts, web frameworks like Django or Flask, and data analysis environments.

pip install openregistry-sdk

Once installed, the SDK can be imported and utilized within any Python environment. It is often recommended to install Python packages within a virtual environment to manage dependencies effectively and avoid conflicts with other projects.

Go

Go projects use the go get command to fetch and install the OpenRegistry Go SDK. The library will be added to your module dependencies and can then be imported into your Go source files.

go get github.com/openregistry/go-sdk

Go modules manage dependencies, and go get will update your go.mod file accordingly. The Go SDK is designed to align with Go's concurrency model and error handling patterns.

Ruby

Ruby developers can install the openregistry-ruby gem using the RubyGems package manager.

gem install openregistry-ruby

After installation, you can require the gem in your Ruby applications. The Ruby SDK aims to provide an idiomatic interface for Ruby developers, leveraging common Ruby patterns and conventions.

Quickstart example

This quickstart example demonstrates how to use the OpenRegistry Python SDK to fetch a list of available public datasets. It covers client initialization, basic authentication, and making a simple API call. Ensure you have installed the Python SDK as described in the OpenRegistry installation guide.

First, you will need an API key, which can be obtained from your OpenRegistry account dashboard. This key is used to authenticate your requests to the API.

import os
from openregistry_sdk import OpenRegistryClient

# Initialize the client with your API key
# It's recommended to load your API key from environment variables
# rather than hardcoding it directly in your application for security.
api_key = os.environ.get("OPENREGISTRY_API_KEY")
if not api_key:
    raise ValueError("OPENREGISTRY_API_KEY environment variable not set.")

client = OpenRegistryClient(api_key=api_key)

try:
    # Fetch a list of available datasets
    # The 'list_datasets' method abstracts the underlying API call
    # and returns a structured response.
    datasets = client.list_datasets(limit=5, offset=0)

    print("Successfully fetched datasets:")
    for dataset in datasets.data:
        print(f"  - ID: {dataset.id}, Name: {dataset.name}, Description: {dataset.description[:70]}...")

    # Accessing metadata about the response
    print(f"\nTotal datasets available: {datasets.total_count}")

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

This Python snippet initializes the client with an API key (preferably from an environment variable for security), then calls the list_datasets method. The response is an object with a data attribute containing a list of dataset objects and a total_count attribute indicating the total number of available datasets. Each dataset object typically contains attributes like id, name, and description, which can be accessed directly.

For more complex operations, such as filtering datasets, retrieving specific data records, or interacting with OpenRegistry's Data Enrichment Services, refer to the OpenRegistry API Reference and the language-specific SDK documentation.

Community libraries

While OpenRegistry provides official SDKs, the broader developer community may contribute additional client libraries, tools, or wrappers that extend functionality or integrate with specific frameworks not officially supported. These community-driven projects can offer alternative approaches to interacting with the OpenRegistry API, sometimes catering to niche use cases or preferred development styles.

Community libraries are typically hosted on platforms like GitHub and distributed via language-specific package managers. Their maintenance, support, and adherence to API changes may vary as they are developed independently of OpenRegistry. Developers considering community libraries should review their source code, activity, and documentation to assess suitability for their projects. Information on community contributions may be found on the OpenRegistry community pages or by searching public code repositories for relevant keywords.

When utilizing third-party libraries, it's prudent to evaluate factors such as the library's documentation quality, its last update date, the responsiveness of its maintainers, and its license. Open-source licenses, such as the MIT License or Apache License 2.0, are common for these types of tools, allowing for broad usage and modification. Resources like Mozilla Developer Network's explanation of open-source software can provide further context on evaluating such projects.