User Guide

This guide provides comprehensive information about using the Amorphic SDK effectively.

Getting Started with Wrapper Classes

The Amorphic SDK provides enhanced wrapper classes that simplify authentication, provide helper utilities, and offer a more user-friendly interface to the underlying OpenAPI client.

Overview of Wrapper Classes

AmorphicApiClient

Enhanced API client with built-in authentication, version checking, and logging

TokenFetcher

Utility for fetching PAT tokens from various sources (environment variables, AWS SSM, Secrets Manager)

HelpCommand

Comprehensive help system for discovering and exploring available APIs

Authentication Setup

Environment Variables

Set up the required environment variables:

export API_GW_URL="https://your-instance.amorphic.com/api"
export ROLE_ID="your-role-id"
export PAT_TOKEN="your-personal-access-token"

Basic Client Creation

import os
import certifi
from openapi_client.amorphic_api_client import AmorphicApiClient

# Create authenticated client
client = AmorphicApiClient.create_with_auth(
    host=os.getenv('API_GW_URL'),
    role_id=os.getenv('ROLE_ID'),
    ssl_ca_cert=certifi.where(),
    debug=False,
    aws_profile=None,
    env_var='PAT_TOKEN'
)

For additional authentication methods and configuration options, see the AmorphicApiClient documentation.

Working with APIs

Using the Datasets API

from openapi_client.api.datasets_api import DatasetsApi
from openapi_client.models.dataset_metadata import DatasetMetadata

# Create API instance
datasets_api = DatasetsApi(client)

# List datasets
datasets = datasets_api.list_datasets(role_id=os.getenv('ROLE_ID'))
print(f"Found {len(datasets)} datasets")

# Create a new dataset
dataset_metadata = DatasetMetadata(
    dataset_name="my_dataset",
    dataset_description="Dataset created via SDK",
    dataset_type="internal",
    domain="examples",
    keywords=["example", "test"],
    file_type="csv",
    table_update="append",
    data_classification=["INTERNAL"],
    file_delimiter=",",
    enable_data_validation=True,
    datasource_type="api",
    TargetLocation="lf"
)

result = datasets_api.create_dataset(
    role_id=os.getenv('ROLE_ID'),
    dataset_metadata=dataset_metadata
)

Next Steps

  • Explore the Wrapper Classes for detailed wrapper class documentation

  • Check out Examples for practical examples using wrapper classes

  • Browse the API Reference for complete API reference

  • Discover available functionality using the built-in help system - see HelpCommand documentation