{ "swagger": "2.0", "info": { "version": "1.0.0", "title": "API de Productos y Usuarios", "description": "API para gestionar productos y usuarios" }, "host": "localhost:9000", "basePath": "/", "tags": [ { "name": "products", "description": "Operaciones con productos" }, { "name": "usuarios", "description": "Operaciones con usuarios" } ], "schemes": [ "http" ], "paths": { "/products": { "get": { "summary": "Obtener todos los productos", "tags": ["products"], "responses": { "200": { "description": "Lista de productos" } } }, "post": { "summary": "Crear un nuevo producto", "tags": ["products"], "parameters": [ { "name": "body", "in": "body", "required": true, "schema": { "$ref": "#/definitions/Product" } } ], "responses": { "201": { "description": "Producto creado con éxito" }, "400": { "description": "Solicitud incorrecta" } } } }, "/products/{id}": { "get": { "summary": "Obtener un producto por ID", "tags": ["products"], "parameters": [ { "name": "id", "in": "path", "required": true, "type": "integer" } ], "responses": { "200": { "description": "Producto obtenido" }, "404": { "description": "Producto no encontrado" } } }, "delete": { "summary": "Eliminar un producto por ID", "tags": ["products"], "parameters": [ { "name": "id", "in": "path", "required": true, "type": "integer" } ], "responses": { "204": { "description": "Producto eliminado" }, "404": { "description": "Producto no encontrado" } } } }, "/productsactu/{id}": { "put": { "summary": "Actualizar un producto por ID", "tags": ["products"], "parameters": [ { "name": "id", "in": "path", "required": true, "type": "integer" }, { "name": "body", "in": "body", "required": true, "schema": { "$ref": "#/definitions/Product" } } ], "responses": { "204": { "description": "Producto actualizado" }, "404": { "description": "Producto no encontrado" } } } }, "/usuarios": { "get": { "summary": "Obtener todos los usuarios", "tags": ["usuarios"], "responses": { "200": { "description": "Lista de usuarios" } } }, "post": { "summary": "Crear un nuevo usuario", "tags": ["usuarios"], "parameters": [ { "name": "body", "in": "body", "required": true, "schema": { "$ref": "#/definitions/Usuario" } } ], "responses": { "201": { "description": "Usuario creado" }, "400": { "description": "Solicitud incorrecta" } } } }, "/verify": { "post": { "summary": "Verificar credenciales del usuario", "tags": ["usuarios"], "parameters": [ { "name": "body", "in": "body", "required": true, "schema": { "$ref": "#/definitions/Usuario" } } ], "responses": { "200": { "description": "Credenciales verificadas" }, "401": { "description": "Credenciales inválidas" } } } } }, "definitions": { "Product": { "type": "object", "properties": { "id": { "type": "integer" }, "title": { "type": "string" }, "price": { "type": "number" }, "description": { "type": "string" }, "category": { "type": "string" }, "image": { "type": "string" } } }, "Usuario": { "type": "object", "properties": { "id": { "type": "integer" }, "username": { "type": "string" }, "email": { "type": "string" }, "password": { "type": "string" } } } } }