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
Field | Type | Description | Required |
---|---|---|---|
cellar | string | Identifier for the use case or project | Yes |
rack | string | Name of the device sending data | Yes |
keg | string | Name of the sensor or metric | Yes |
value | number | The sensor reading or metric value | Yes |
timestamp | string | ISO 8601 formatted timestamp | Yes |
Timestamp Format
Use ISO 8601 format for timestamps:
YYYY-MM-DDThh:mm:ssZ
Example: 2024-03-20T10:30:00Z
YYYY
: 4-digit yearMM
: 2-digit month (01-12)DD
: 2-digit day (01-31)T
: Literal 'T' separatorhh
: 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
-
Data Validation
- Validate data before sending
- Ensure timestamps are in UTC
- Check value ranges
-
Error Handling
- Implement retry logic
- Handle rate limits
- Log failed requests
-
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?
- Contact support at support@brewry.xyz
- Visit our Support Center