Skip to main content

Pushing Data to Brewry

Learn how to send telemetry data to Brewry using our ingestion API.

Data Ingestion Endpoint

POST https://tap.brewry.xyz/api/v1/ingest

Request Format

Headers

Content-Type: application/json
X-API-Key: YOUR_API_KEY

Request Body

{
"cellar": "string", // Use case identifier
"rack": "string", // Device name
"keg": "string", // Sensor name
"value": number, // Sensor reading
"timestamp": "string" // ISO 8601 timestamp
}

Field Descriptions

FieldTypeDescriptionRequired
cellarstringIdentifier for the use case or projectYes
rackstringName of the device sending dataYes
kegstringName of the sensor or metricYes
valuenumberThe sensor reading or metric valueYes
timestampstringISO 8601 formatted timestampYes

Timestamp Format

Use ISO 8601 format for timestamps:

YYYY-MM-DDThh:mm:ssZ

Example: 2024-03-20T10:30:00Z

  • YYYY: 4-digit year
  • MM: 2-digit month (01-12)
  • DD: 2-digit day (01-31)
  • T: Literal 'T' separator
  • hh: 2-digit hour (00-23)
  • mm: 2-digit minute (00-59)
  • ss: 2-digit second (00-59)
  • Z: UTC timezone indicator

Example Requests

Using cURL

curl -X POST https://tap.brewry.xyz/api/v1/ingest \
-H "Content-Type: application/json" \
-H "X-API-Key: YOUR_API_KEY" \
-d '{
"cellar": "weather-station",
"rack": "rooftop-sensor",
"keg": "temperature",
"value": 25.5,
"timestamp": "2024-03-20T10:30:00Z"
}'

Using Python

import requests
import datetime

url = "https://tap.brewry.xyz/api/v1/ingest"
headers = {
"Content-Type": "application/json",
"X-API-Key": "YOUR_API_KEY"
}
data = {
"cellar": "weather-station",
"rack": "rooftop-sensor",
"keg": "temperature",
"value": 25.5,
"timestamp": datetime.datetime.utcnow().isoformat() + "Z"
}

response = requests.post(url, json=data, headers=headers)

Response Format

Success Response

{
"status": "success",
"message": "Data ingested successfully",
"timestamp": "2024-03-20T10:30:00Z"
}

Error Response

{
"status": "error",
"error": "Error message",
"code": "ERROR_CODE"
}

Best Practices

  1. Data Validation

    • Validate data before sending
    • Ensure timestamps are in UTC
    • Check value ranges
  2. Error Handling

    • Implement retry logic
    • Handle rate limits
    • Log failed requests
  3. Performance

    • Batch data when possible
    • Monitor response times
    • Implement backoff strategies

Rate Limiting

See the Rate Limiting section for details on API usage limits.

Data Retention

See the Data Retention section for information about data storage policies.

Support

Need help with data ingestion?