SDKs overview

Onyx Bazaar provides Software Development Kits (SDKs) and client libraries designed to facilitate programmatic interaction with its data services, including the Onyx Data Lake, Onyx Query Engine, and Onyx Data Catalog. These SDKs abstract the underlying RESTful API, offering language-specific methods and data structures to streamline development workflows Onyx Bazaar documentation portal. The primary goal of these libraries is to reduce the effort required for tasks such as authenticating requests, formatting queries, and parsing responses, allowing developers to focus on data utilization rather than API mechanics.

The official SDKs are maintained by Onyx Bazaar and are typically kept up-to-date with the latest API versions and features. They aim to provide a consistent and idiomatic interface for each supported programming language. In addition to official offerings, the Onyx Bazaar ecosystem may include community-contributed libraries, which can offer specialized functionalities or support for additional programming environments. Developers can utilize these tools to integrate Onyx Bazaar data into various applications, ranging from research projects and data science prototypes to small business data integrations and geospatial analysis systems.

Official SDKs by language

Onyx Bazaar offers official SDKs for several popular programming languages, designed to provide comprehensive access to its API capabilities. These SDKs are developed and maintained by Onyx Bazaar engineers to ensure compatibility, performance, and adherence to best practices for each language environment. Each SDK typically includes modules for authentication, data retrieval, query construction, and response handling.

The table below summarizes the official SDKs, their respective package names, and common installation commands:

Language Package Name Installation Command Maturity
Python onyxbazaar-py pip install onyxbazaar-py Stable
JavaScript @onyxbazaar/js-sdk npm install @onyxbazaar/js-sdk or yarn add @onyxbazaar/js-sdk Stable
Go github.com/onyxbazaar/go-sdk go get github.com/onyxbazaar/go-sdk Stable

These packages are hosted on their respective language-specific package managers (PyPI for Python, npm for JavaScript, and Go Modules for Go), making them discoverable and easy to integrate into existing projects. Developers should refer to the Onyx Bazaar API reference for detailed documentation on SDK methods and available endpoints.

Installation

Installing Onyx Bazaar SDKs is typically performed using the standard package management tools for each programming language. Before installation, ensure that the appropriate language runtime and package manager are set up in your development environment. For example, Python requires pip, and JavaScript requires npm or yarn. Go projects manage dependencies using Go Modules.

Python SDK Installation

To install the Python SDK, onyxbazaar-py, use pip, the standard package installer for Python:

pip install onyxbazaar-py

It is generally recommended to install Python packages within a Python virtual environment to manage project-specific dependencies without conflicts.

JavaScript SDK Installation

For JavaScript projects, the @onyxbazaar/js-sdk can be installed using either npm or yarn:

Using npm:

npm install @onyxbazaar/js-sdk

Using yarn:

yarn add @onyxbazaar/js-sdk

This will add the SDK as a dependency to your project's package.json file.

Go SDK Installation

To integrate the Go SDK, github.com/onyxbazaar/go-sdk, into your Go project, use the go get command:

go get github.com/onyxbazaar/go-sdk

This command downloads the module and adds it to your go.mod file, managing its version as part of your project's dependencies.

Quickstart example

This section provides a quickstart example demonstrating how to retrieve data using the Onyx Bazaar Python SDK. The example assumes you have an API key, which is required for authentication with the Onyx Bazaar API Onyx Bazaar authentication guide. API keys can be obtained from your Onyx Bazaar account dashboard.

Python Quickstart

The following Python snippet demonstrates how to initialize the client, authenticate with an API key, and make a simple query to retrieve data from a specified dataset. Replace "YOUR_API_KEY" and "your-dataset-id" with your actual credentials and the identifier of the dataset you wish to access.

import os
from onyxbazaar_py import OnyxClient
from onyxbazaar_py.exceptions import OnyxAPIError

# Initialize the client with your API key
# It's recommended to store API keys as environment variables
api_key = os.environ.get("ONYX_BAZAAR_API_KEY", "YOUR_API_KEY")
client = OnyxClient(api_key=api_key)

try:
    # Define your query parameters
    dataset_id = "your-dataset-id" # Example: "annual-economic-indicators"
    query_params = {
        "limit": 5,
        "offset": 0,
        "filters": {
            "country": "USA",
            "year__gte": 2020
        }
    }

    # Fetch data from the Onyx Query Engine
    print(f"Fetching data from dataset: {dataset_id}...")
    response = client.query_engine.get_data(dataset_id=dataset_id, params=query_params)

    # Process the retrieved data
    if response.status_code == 200:
        data = response.json()
        print("Successfully retrieved data:")
        for item in data["results"]:
            print(item)
        print(f"Total records found: {data['total_count']}")
    else:
        print(f"Error fetching data: {response.status_code} - {response.text}")

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

This example demonstrates a basic data retrieval operation. The OnyxClient provides methods to interact with various Onyx Bazaar services, including the Data Catalog for discovering datasets and the Data Lake for direct file access. More complex queries, data transformations, and write operations are detailed in the Onyx Bazaar API reference documentation.

Community libraries

Beyond the official SDKs, the Onyx Bazaar ecosystem may include community-contributed libraries and tools developed by independent developers. These libraries often address specific use cases, provide integrations with other platforms, or offer alternative interfaces to the Onyx Bazaar API. While not officially supported by Onyx Bazaar, community libraries can be valuable resources for developers seeking specialized functionalities or different programming language support.

Examples of community contributions might include:

  • Data connectors for popular analytics platforms (e.g., a custom connector for Tableau or Power BI).
  • Command-line interface (CLI) tools that wrap common API operations for scripting and automation.
  • Client libraries in other languages (e.g., Ruby, C#, Java) that are not officially supported.
  • Specialized data visualization tools that integrate directly with Onyx Bazaar data streams.

Developers interested in leveraging community libraries should verify their source, maintenance status, and compatibility with the current Onyx Bazaar API version. Resources like GitHub and community forums are common places to discover and contribute to such projects. For example, GitHub hosts numerous open-source projects, and developers can search for relevant repositories using keywords like "Onyx Bazaar" and the desired programming language.

When considering community libraries, it is advisable to:

  • Check the project's documentation and examples.
  • Review the last commit date to assess active maintenance.
  • Examine the issue tracker for known bugs or limitations.
  • Understand the licensing terms of the library.

For critical applications, relying on officially supported SDKs is generally recommended due to guaranteed compatibility and ongoing support from Onyx Bazaar. However, community libraries can accelerate development for niche requirements or provide innovative solutions not yet available through official channels.