{
"openapi": "3.0.3",
"info": {
"title": "bgustscraper Secure Web API",
"description": "Especificación de API y documentación OpenAPI para la extracción semántica y gestión de caché de bgustscraper.",
"version": "1.0.0"
},
"servers": [
{
"url": "http://localhost:8080",
"description": "Servidor local por defecto"
}
],
"paths": {
"/api/auth": {
"post": {
"summary": "Autenticación de usuario",
"description": "Valida las credenciales de administración del sistema y entrega un token JWT firmado de corta duración.",
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"type": "object",
"required": ["username", "password"],
"properties": {
"username": {
"type": "string",
"example": "admin"
},
"password": {
"type": "string",
"format": "password",
"example": "bgust2026"
}
}
}
}
}
},
"responses": {
"200": {
"description": "Autenticación exitosa",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"token": {
"type": "string",
"description": "Token JWT firmado codificado en Base64"
}
}
}
}
}
},
"401": {
"description": "Credenciales inválidas",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ErrorResponse"
}
}
}
}
}
}
},
"/api/bcv": {
"get": {
"summary": "Obtener tasas cambiarias del BCV",
"description": "Retorna las últimas tasas de divisas oficiales del Dólar y Euro recolectadas de forma programada y semántica.",
"security": [
{
"BearerAuth": []
}
],
"responses": {
"200": {
"description": "Retorno de tasas cambiarias exitoso",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"USD": {
"type": "number",
"example": 36.45
},
"EUR": {
"type": "number",
"example": 39.12
}
}
}
}
}
},
"401": {
"description": "Acceso no autorizado (Token JWT ausente o inválido)",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ErrorResponse"
}
}
}
},
"404": {
"description": "No se han capturado datos todavía",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ErrorResponse"
}
}
}
}
}
}
},
"/api/cache": {
"get": {
"summary": "Obtener estado de caché local",
"description": "Consulta y devuelve metadatos sobre el estado de la base de datos embebida redb.",
"security": [
{
"BearerAuth": []
}
],
"responses": {
"200": {
"description": "Estado de la base de datos",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"status": {
"type": "string",
"example": "active"
},
"storage_engine": {
"type": "string",
"example": "redb"
},
"database_path": {
"type": "string",
"example": "downloads/cache.db"
},
"info": {
"type": "string",
"example": "La base de datos embebida redb está en ejecución."
}
}
}
}
}
},
"401": {
"description": "Token inválido o ausente",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ErrorResponse"
}
}
}
}
}
}
}
},
"components": {
"securitySchemes": {
"BearerAuth": {
"type": "http",
"scheme": "bearer",
"bearerFormat": "JWT",
"description": "Ingresa el token en formato Bearer <token>"
}
},
"schemas": {
"ErrorResponse": {
"type": "object",
"properties": {
"error": {
"type": "string",
"example": "Detalle del error ocurrido"
}
}
}
}
}
}