⚙️ WIA-DATA-014 API Reference

The WIA Time-Series Data API provides a standardized interface for ingesting, querying, and managing time-series data across different database systems.

Authentication

All API requests require authentication using an API key in the header:

Authorization: Bearer YOUR_API_KEY

Base URL

https://api.wiastandards.com/v1/timeseries

Data Ingestion

POST /write

Write time-series data points to the database.

Request Body

{
  "measurement": "temperature",
  "tags": {
    "location": "server1",
    "region": "us-east-1"
  },
  "fields": {
    "value": 23.5,
    "unit": "celsius"
  },
  "timestamp": "2025-12-26T10:30:00Z"
}

Response

{
  "status": "success",
  "points_written": 1,
  "timestamp": "2025-12-26T10:30:01Z"
}

POST /write/batch

Write multiple data points in a single request.

Request Body

{
  "points": [
    {
      "measurement": "cpu",
      "tags": {"host": "server1"},
      "fields": {"value": 45.2},
      "timestamp": "2025-12-26T10:30:00Z"
    },
    {
      "measurement": "cpu",
      "tags": {"host": "server2"},
      "fields": {"value": 67.8},
      "timestamp": "2025-12-26T10:30:00Z"
    }
  ]
}

Data Querying

GET /query

Query time-series data with filters and aggregations.

Query Parameters

Parameter Type Description
measurement string Measurement name (required)
start ISO8601 Start timestamp (required)
end ISO8601 End timestamp (required)
tags object Filter by tags (optional)
aggregation string mean, sum, min, max, count (optional)
interval string Group by interval: 1m, 5m, 1h, 1d (optional)

Example Request

GET /query?measurement=temperature&start=2025-12-26T00:00:00Z&end=2025-12-26T23:59:59Z&aggregation=mean&interval=1h

Response

{
  "measurement": "temperature",
  "results": [
    {
      "timestamp": "2025-12-26T00:00:00Z",
      "value": 22.3
    },
    {
      "timestamp": "2025-12-26T01:00:00Z",
      "value": 21.8
    }
  ],
  "count": 24
}

POST /query/advanced

Execute advanced queries with custom expressions.

Request Body

{
  "query": "SELECT mean(value) FROM temperature WHERE location='server1' GROUP BY time(1h)",
  "format": "json"
}

Anomaly Detection

POST /anomaly/detect

Detect anomalies in time-series data using statistical methods.

Request Body

{
  "measurement": "cpu",
  "start": "2025-12-26T00:00:00Z",
  "end": "2025-12-26T23:59:59Z",
  "method": "zscore",
  "threshold": 3.0
}

Response

{
  "anomalies": [
    {
      "timestamp": "2025-12-26T14:23:15Z",
      "value": 98.5,
      "zscore": 3.2,
      "severity": "high"
    }
  ],
  "total_anomalies": 5
}

Forecasting

POST /forecast

Generate forecasts for future values.

Request Body

{
  "measurement": "network_traffic",
  "history_start": "2025-12-20T00:00:00Z",
  "history_end": "2025-12-26T00:00:00Z",
  "forecast_periods": 24,
  "model": "arima"
}

Response

{
  "forecast": [
    {
      "timestamp": "2025-12-27T00:00:00Z",
      "predicted_value": 156.3,
      "confidence_interval": [142.1, 170.5]
    }
  ]
}

Data Management

GET /measurements

List all available measurements.

Response

{
  "measurements": [
    "temperature",
    "cpu",
    "memory",
    "network_traffic"
  ]
}

DELETE /data

Delete data by time range and filters.

Query Parameters

DELETE /data?measurement=temperature&start=2025-01-01T00:00:00Z&end=2025-01-31T23:59:59Z

Retention Policies

POST /retention

Configure data retention policies.

Request Body

{
  "name": "one_week",
  "duration": "7d",
  "replication": 1,
  "default": false
}

Error Codes

Code Description
200 Success
400 Bad Request - Invalid parameters
401 Unauthorized - Invalid API key
404 Not Found - Resource doesn't exist
429 Too Many Requests - Rate limit exceeded
500 Internal Server Error

Rate Limits