SDKs overview

STAPI provides Software Development Kits (SDKs) and client libraries designed to facilitate interaction with its video and audio processing APIs. These SDKs abstract the underlying RESTful API calls, handling authentication, request formatting, and response parsing, which streamlines the integration process for developers. The availability of SDKs in multiple programming languages allows developers to work within their preferred environments, accelerating the development of video-centric applications, live event streaming platforms, and scalable video-on-demand services STAPI official documentation.

The SDKs are generally structured to map directly to STAPI's core product offerings, including video upload, encoding, playback, live stream management, and analytics data retrieval. This design principle aims to provide a consistent and intuitive developer experience, irrespective of the chosen programming language.

Official SDKs by language

STAPI provides official SDKs for several popular programming languages, ensuring broad compatibility for various development environments. These SDKs are maintained by STAPI and are the recommended method for integrating with the platform.

Language Package Name Install Command Example Maturity
JavaScript @stapi/js-sdk npm install @stapi/js-sdk or yarn add @stapi/js-sdk Stable
Python stapi-python pip install stapi-python Stable
Ruby stapi-ruby gem install stapi-ruby Stable
Go github.com/stapi/go-sdk go get github.com/stapi/go-sdk Stable
PHP stapi/php-sdk composer require stapi/php-sdk Stable
Node.js @stapi/nodejs-sdk npm install @stapi/nodejs-sdk or yarn add @stapi/nodejs-sdk Stable

Each SDK is designed to encapsulate the complexities of API communication, allowing developers to focus on application logic rather than low-level HTTP requests. For instance, authenticating API requests often involves securely transmitting API keys or tokens, a process managed by the SDKs STAPI API reference on authentication. This is a common practice across many API providers to enhance security and ease of use, as exemplified by Stripe's approach to API key management in their own SDKs Stripe API keys documentation.

Installation

Installation of STAPI SDKs typically follows standard package management practices for each respective language. Below are detailed instructions for the primary supported languages.

JavaScript / Node.js

For both browser-based JavaScript applications and Node.js backend services, the SDK can be installed via npm or yarn:

# Using npm
npm install @stapi/js-sdk

# Using yarn
yarn add @stapi/js-sdk

Python

The Python SDK is distributed via PyPI and can be installed using pip:

pip install stapi-python

Ruby

The Ruby SDK is available as a gem and can be installed using Bundler or directly with gem install:

# Add to your Gemfile
gem 'stapi-ruby'

# Then run:
bundle install

# Or directly:
gem install stapi-ruby

Go

The Go SDK can be integrated into your project using go get:

go get github.com/stapi/go-sdk

PHP

The PHP SDK is managed via Composer:

composer require stapi/php-sdk

After installation, it is recommended to consult the specific SDK's documentation for detailed configuration and initialization steps, including how to set up API keys and handle environment variables securely STAPI SDKs overview.

Quickstart example

This example demonstrates how to initialize the STAPI SDK and upload a video file using Python. This quickstart assumes you have your STAPI API key readily available.

import os
from stapi_python import STAPIClient

# Initialize the STAPI client with your API key
# It's recommended to store API keys as environment variables for security
api_key = os.environ.get("STAPI_API_KEY")
if not api_key:
    raise ValueError("STAPI_API_KEY environment variable not set.")

client = STAPIClient(api_key=api_key)

def upload_video(file_path, title, description):
    try:
        # Upload the video file
        with open(file_path, 'rb') as video_file:
            upload_response = client.video.upload(
                file=video_file,
                title=title,
                description=description,
                metadata={'source': 'python-sdk-example'}
            )
        
        print(f"Video uploaded successfully! Video ID: {upload_response.id}")
        print(f"Playback URL: {upload_response.playback_url}")
        return upload_response
    except Exception as e:
        print(f"Error uploading video: {e}")
        return None

# Example usage:
# Replace 'path/to/your/video.mp4' with the actual path to your video file
# video_file_path = "path/to/your/video.mp4"
# video_title = "My First STAPI Upload"
# video_description = "A video uploaded using the STAPI Python SDK quickstart."

# if os.path.exists(video_file_path):
#     uploaded_video = upload_video(video_file_path, video_title, video_description)
#     if uploaded_video:
#         print("Further actions can be performed with the uploaded video.")
# else:
#     print(f"Error: Video file not found at {video_file_path}")

This Python example illustrates the basic steps: client initialization, opening a file, and invoking the video upload method. The response typically includes a video ID and playback URL, which can then be used for embedding or further processing. Similar quickstart guides and examples are available for other languages in the STAPI documentation STAPI Python SDK quickstart.

Community libraries

While STAPI provides official SDKs for core functionalities, the developer community may contribute additional libraries or tools that extend STAPI's capabilities or offer integrations with specific frameworks. These community-driven projects can include:

  • Framework-specific wrappers: Libraries that integrate STAPI services more seamlessly into popular web frameworks like React, Angular, Vue.js, Django, or Ruby on Rails.
  • Specialized tools: Utilities for specific tasks, such as advanced video manipulation, custom analytics dashboards, or integrations with content delivery networks (CDNs) beyond STAPI's default offerings.
  • CLI tools: Command-line interfaces for managing STAPI resources without writing code.

Community libraries are often hosted on platforms like GitHub and can be discovered through STAPI's developer forums, community sections of the official documentation, or by searching package repositories. It is important to note that community libraries may vary in terms of maintenance, support, and stability compared to official SDKs. Developers should review the project's documentation, issue tracker, and contribution guidelines before integrating them into production systems. For instance, many API providers, including Google Cloud, maintain a distinction between official client libraries and community-contributed tools, often providing guidelines for evaluating third-party integrations Google Cloud client libraries overview.

Currently, STAPI's primary focus is on maintaining and enhancing its official SDKs to ensure a consistent and reliable experience across all supported languages. Information on community contributions, if available, would typically be found in a dedicated section of the official STAPI developer portal or through community-driven platforms.