@extends('layouts.app') @section('title', 'Sensor API Documentation') @section('content')
Documentation for integrating with the GasGuard Sensor API
All API requests require authentication using an API token. Include the token in the Authorization
header.
Authorization: Bearer your_api_token_here
GET /api/v1/sensors/{uuid}
# Example Response
{
"data": {
"id": 1,
"device_uuid": "a1b2c3d4-e5f6-7890-g1h2-i3j4k5l6m7n8",
"name": "Kitchen Sensor",
"gas_company_id": 1,
"gas_level": 65.5,
"battery_level": 85,
"status": "online",
"last_ping": "2023-07-13T12:34:56Z",
"created_at": "2023-06-15T08:30:00Z",
"updated_at": "2023-07-13T12:34:56Z"
}
}
PUT /api/v1/sensors/{uuid}
# Example Request Body
{
"gas_level": 65.5,
"battery_level": 85,
"status": "online"
}
# Example Response
{
"message": "Sensor data updated successfully",
"data": {
"id": 1,
"device_uuid": "a1b2c3d4-e5f6-7890-g1h2-i3j4k5l6m7n8",
"gas_level": 65.5,
"battery_level": 85,
"status": "online",
"last_ping": "2023-07-13T12:35:00Z"
}
}
401 Unauthorized
Invalid or missing API token
{
"message": "Unauthenticated."
}
404 Not Found
Sensor not found
{
"message": "No query results for model [App\\Models\\Sensor]"
}
422 Unprocessable Entity
Validation error
{
"message": "The given data was invalid.",
"errors": {
"gas_level": [
"The gas level must be a number."
]
}
}
API requests are limited to 60 requests per minute per IP address. Exceeding this limit will result in a 429 Too Many Requests response.