SDKs overview
Times Adder provides Software Development Kits (SDKs) and client libraries to facilitate interaction with its Time Series Aggregation, Anomaly Detection, and Forecasting APIs. These SDKs abstract the underlying HTTP requests and response parsing, allowing developers to integrate Times Adder functionalities using idiomatic language constructs. The primary goal of these libraries is to reduce the boilerplate code required for authentication, data serialization, and error handling, thereby accelerating development cycles. Utilizing an SDK can simplify tasks like submitting time series data points, configuring aggregation queries, or retrieving anomaly detection results, as detailed in the Times Adder documentation. For instance, instead of manually crafting JSON payloads for each API call, developers can use methods provided by the SDKs that accept native data structures like dictionaries or objects.
The SDKs are designed to be compatible with various application architectures, from backend services to client-side applications (where applicable, such as with JavaScript). They typically handle API key management and secure communication (e.g., HTTPS), aligning with best practices for API integration. This approach mirrors how many modern API platforms, such as Stripe's API libraries, provide language-specific tools to streamline developer workflows. The official SDKs are regularly updated to ensure compatibility with the latest API versions and to incorporate new features or performance improvements. Community-contributed libraries, while not officially maintained, can offer additional language support or specialized functionalities, but their reliability and maintenance schedule may vary.
Official SDKs by language
Times Adder offers official SDKs for popular programming languages, ensuring robust and supported integration paths. These SDKs are maintained by Times Adder and are the recommended method for interacting with the platform's APIs. Each SDK is designed to reflect the native conventions of its respective language, providing a natural development experience. The core functionalities exposed by the APIs, such as data ingestion, query execution, and result retrieval, are encapsulated within intuitive methods and classes in each SDK. For example, the Python SDK might offer a timesadder.client.aggregate() method, while the JavaScript SDK would provide timesadderClient.aggregate(). These methods typically accept parameters that map directly to the API's request body, and they return data structures that are easy to process in the target language.
The following table provides an overview of the officially supported SDKs, including their package names and typical installation commands:
| Language | Package Manager/Name | Installation Command | Maturity |
|---|---|---|---|
| Python | timesadder-python (PyPI) |
pip install timesadder-python |
Stable |
| JavaScript | @timesadder/js-sdk (npm) |
npm install @timesadder/js-sdk |
Stable |
| Go | github.com/timesadder/go-sdk |
go get github.com/timesadder/go-sdk |
Stable |
Each official SDK includes comprehensive documentation, often with code examples, to assist developers in getting started quickly. The Times Adder documentation portal provides specific guides for each language, detailing authentication, common use cases, and error handling patterns. These resources are crucial for understanding how to effectively use the SDKs to implement real-time data aggregation and analysis features within applications.
Installation
Installing a Times Adder SDK is typically a straightforward process using the standard package manager for each language. This section outlines the common installation steps for the official Python, JavaScript, and Go SDKs. Before installation, ensure you have the appropriate language runtime and package manager installed on your system.
Python SDK Installation
The Python SDK is distributed via PyPI (Python Package Index). To install it, use pip, Python's package installer:
pip install timesadder-python
It's often recommended to install Python packages within a Python virtual environment to manage dependencies effectively and avoid conflicts with other projects. After installation, you can import the library into your Python scripts:
import timesadder
# Initialize the client
client = timesadder.Client(api_key="YOUR_API_KEY")
JavaScript SDK Installation
The JavaScript SDK is available through npm (Node Package Manager) and can be used in Node.js environments or bundled for client-side web applications. To install:
npm install @timesadder/js-sdk
Alternatively, if you use Yarn:
yarn add @timesadder/js-sdk
Once installed, you can import and use the SDK in your JavaScript or TypeScript projects:
import { TimesAdderClient } from '@timesadder/js-sdk';
const client = new TimesAdderClient('YOUR_API_KEY');
Go SDK Installation
The Go SDK is typically installed using the go get command, which fetches the package from its Git repository and adds it to your module cache:
go get github.com/timesadder/go-sdk
After running this command, you can import the package into your Go application:
package main
import (
"fmt"
"github.com/timesadder/go-sdk/timesadder"
)
func main() {
client := timesadder.NewClient("YOUR_API_KEY")
// Use the client
fmt.Println("Times Adder Go client initialized.")
}
Ensure your Go environment is properly set up with Go modules enabled for dependency management.
Quickstart example
This section provides a quickstart example using the Python SDK to demonstrate a common use case: aggregating time series data. This example assumes you have already installed the timesadder-python package and have a valid API key from your Times Adder Developer Plan or paid subscription.
import timesadder
import datetime
def main():
# Replace with your actual API key
API_KEY = "YOUR_TIMES_ADDER_API_KEY"
# Initialize the Times Adder client
client = timesadder.Client(api_key=API_KEY)
print("Times Adder client initialized.")
# Define some sample time series data points
# In a real application, this data would come from sensors, databases, etc.
sample_data = [
{"timestamp": datetime.datetime(2026, 1, 1, 10, 0, 0), "value": 10.5, "tag": "sensor_a"},
{"timestamp": datetime.datetime(2026, 1, 1, 10, 1, 0), "value": 12.1, "tag": "sensor_a"},
{"timestamp": datetime.datetime(2026, 1, 1, 10, 2, 0), "value": 11.8, "tag": "sensor_b"},
{"timestamp": datetime.datetime(2026, 1, 1, 10, 3, 0), "value": 13.0, "tag": "sensor_a"},
]
try:
# Ingest data (optional, if you're not using a streaming source)
print("Ingesting sample data...")
ingestion_response = client.ingest_data(data=sample_data)
print(f"Data ingestion successful: {ingestion_response.get('message')}")
# Define aggregation parameters
# Aggregate 'value' field for 'sensor_a' over a 5-minute window, calculating the average
aggregation_query = {
"start_time": datetime.datetime(2026, 1, 1, 9, 55, 0).isoformat(),
"end_time": datetime.datetime(2026, 1, 1, 10, 5, 0).isoformat(),
"metric": "value",
"tags": {"tag": "sensor_a"},
"interval": "5m", # 5-minute aggregation window
"aggregation_method": "average"
}
# Perform the aggregation
print("Performing time series aggregation...")
aggregation_result = client.aggregate(query=aggregation_query)
print("Aggregation Result:")
if aggregation_result and aggregation_result.get("data"):
for item in aggregation_result["data"]:
print(f" Timestamp: {item['timestamp']}, Aggregated Value: {item['average_value']:.2f}")
else:
print(" No aggregation data found or an error occurred.")
# Example of anomaly detection (assuming you have a model configured)
print("Checking for anomalies (example, requires pre-trained model)...")
anomaly_query = {
"start_time": datetime.datetime(2026, 1, 1, 9, 0, 0).isoformat(),
"end_time": datetime.datetime(2026, 1, 1, 10, 30, 0).isoformat(),
"metric": "value",
"tags": {"tag": "sensor_a"},
"model_id": "your_anomaly_model_id" # Replace with actual model ID
}
# anomaly_results = client.detect_anomalies(query=anomaly_query)
# print(f"Anomaly Detection Results: {anomaly_results}")
except timesadder.TimesAdderError as e:
print(f"An API error occurred: {e}")
except Exception as e:
print(f"An unexpected error occurred: {e}")
if __name__ == "__main__":
main()
This Python quickstart demonstrates:
- Initializing the
TimesAdderClientwith an API key. - Ingesting sample time series data points.
- Constructing and executing an aggregation query to calculate the average value for a specific sensor over a defined time window.
- Placeholder for anomaly detection, indicating how other API calls would be structured.
For more detailed examples, including error handling, advanced querying, and specific use cases for anomaly detection or forecasting, refer to the Times Adder API reference documentation.
Community libraries
While Times Adder provides official SDKs for Python, JavaScript, and Go, the open nature of APIs often fosters the development of community-contributed libraries. These libraries can extend support to additional programming languages, offer specialized integrations with other platforms, or provide alternative abstractions over the core API. Community libraries are typically found on public code repositories like GitHub or language-specific package managers not officially supported by Times Adder.
For instance, a developer might create a Ruby gem or a PHP package that wraps the Times Adder REST API. These contributions can be valuable for developers working in ecosystems not covered by official SDKs. However, it is important to note that community libraries generally do not receive the same level of support, maintenance, or security auditing as official SDKs. Developers considering community libraries should:
- Verify the source: Check the reputation of the maintainer and the activity on the project's repository.
- Review the code: Assess the code quality, adherence to best practices, and potential security vulnerabilities.
- Check documentation: Ensure the library is well-documented and provides clear examples.
- Monitor maintenance: Confirm that the library is actively maintained and compatible with the latest Times Adder API versions.
As of the latest information, specific widely adopted community libraries for Times Adder are still emerging. Developers are encouraged to explore platforms like GitHub topics for 'timesadder-api' or relevant language-specific forums to discover and contribute to such projects. When a community library is chosen, it becomes the responsibility of the integrating team to ensure its ongoing compatibility and security. The official Times Adder documentation remains the authoritative source for API specifications, regardless of whether an official or community SDK is used for integration.