Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/LucaXGit/proyecto-final-jaz/llms.txt

Use this file to discover all available pages before exploring further.

Sending a POST request with accion=crear inserts a new product into the productos table. The request body must be form-encoded (application/x-www-form-urlencoded). On success the servlet returns {"success": true}; if the INSERT fails for any reason it returns {"success": false}.

Request

Method: POST
URL: http://localhost:8080/ServidorTiendaPlayeras/ProductoServlet
Content-Type: application/x-www-form-urlencoded

Parameters

accion
string
required
Dispatch key for the POST handler. Must be exactly "crear" to reach the create branch.
nombre
string
required
The product name, e.g. "Playera Oversize Anime".
talla
string
required
The t-shirt size. Accepted values: CH, M, G, XG.
precio
number
required
The price in Mexican Pesos (MXN). Parsed server-side as a double, e.g. 299.90.
stock
integer
required
The initial inventory count. Parsed server-side as an int, e.g. 20.

curl Example

curl -X POST http://localhost:8080/ServidorTiendaPlayeras/ProductoServlet \
  -d "accion=crear&nombre=Playera+Oversize+Anime&talla=M&precio=299.90&stock=20"

PHP (Laravel) Example

The PlayerasController::store() method uses Laravel’s HTTP client with asForm() to send a form-encoded POST request:
Http::asForm()->post($this->apiUrl, [
    'accion'  => 'crear',
    'nombre'  => $request->nombre,
    'talla'   => $request->talla,
    'precio'  => $request->precio,
    'stock'   => $request->stock,
]);

SQL Executed

INSERT INTO productos (nombre, talla, precio, stock) VALUES (?, ?, ?, ?)

Response

success
boolean
true if the product was inserted successfully; false if the INSERT statement failed (e.g., due to a constraint violation or database error).
Success:
{ "success": true }
Failure:
{ "success": false }

Build docs developers (and LLMs) love