Introduction
The Conversor de Unidades REST API provides programmatic access to unit conversion functionality through a Flask web server. The API acts as a bridge between the frontend and the ICE (Internet Communications Engine) server running on port 10000.Base URL
All API endpoints are relative to your Flask server URL:HOST: Server host (default:localhost)PORT: Server port (default:5000)
The Flask server must be connected to the ICE server on port 10000 for the API to function properly.
Authentication
The API currently does not require authentication. All endpoints are publicly accessible.Available Endpoints
The API provides three main endpoints:Convert Units
Convert values between different units
Get Units
Retrieve available units for a category
Status
Check ICE server connection status
Supported Categories
The API supports conversion for four unit categories:- temperatura: Temperature units (Celsius, Fahrenheit, Kelvin)
- longitud: Length/distance units (meters, kilometers, miles, feet)
- peso: Weight/mass units (kilograms, pounds, grams)
- velocidad: Speed/velocity units (km/h, mph, m/s)
Error Handling
The API uses standard HTTP status codes and returns errors in JSON format:HTTP Status Codes
| Status Code | Description |
|---|---|
200 | Request successful |
400 | Bad request (invalid parameters, category, or unit) |
404 | Route not found |
500 | Internal server error |
503 | Service unavailable (ICE server disconnected) |
Error Response Format
All errors follow this consistent structure:Common Error Types
Unidad Inválida (Invalid Unit)
Unidad Inválida (Invalid Unit)
Returned when an invalid unit is specified for a category.Status Code:
400Example:Categoría Inválida (Invalid Category)
Categoría Inválida (Invalid Category)
Returned when an unsupported category is requested.Status Code:
400Example:Servidor Desconectado (Server Disconnected)
Servidor Desconectado (Server Disconnected)
Returned when the ICE server is not connected.Status Code:
503Example:Valor Inválido (Invalid Value)
Valor Inválido (Invalid Value)
Returned when a non-numeric value is provided.Status Code:
400Example:Rate Limits
There are currently no rate limits implemented on the API.CORS Policy
The Flask server serves both the API and frontend from the same origin, so CORS is not configured. If you need to access the API from a different origin, you’ll need to configure CORS headers.Next Steps
Convert Units
Learn how to perform unit conversions
Get Available Units
Discover which units are available