Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/ricpalomino/spring-boot/llms.txt

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

The update endpoint fully replaces the name and price of an existing product identified by its numeric ID. You must supply both fields in the request body — this is a full replacement, not a partial update. If the ID does not exist in the store, the API returns 404. If the request body fails validation, the API returns 400.

Path parameters

id
integer
required
The numeric ID of the product to update. Must correspond to an existing product in the store.

Request body

name
string
required
The new product name. Must be between 3 and 100 characters and cannot be blank.
price
number
required
The new product price. Must be greater than 0 (minimum value: 1).

Request

curl --request PUT \
  --url http://localhost:8080/api/v1/products/1 \
  --header "Content-Type: application/json" \
  --data '{
    "name": "Laptop Pro 16",
    "price": 1499.99
  }'

Response fields

responseCode
string
HTTP status code as a string (e.g., "200", "400", "404").
responseMessage
string
Human-readable message describing the result.
data
object | null
The updated product object, or null on error.

Success response — 200

{
  "responseCode": "200",
  "responseMessage": "Producto actualizado correctamente",
  "data": {
    "id": 1,
    "name": "Laptop Pro 16",
    "price": 1499.99
  }
}

Validation error response — 400

Returned when name is blank or out of range, or when price is less than 1. The data field contains a map of failing field names to their constraint violation messages.
{
  "responseCode": "400",
  "responseMessage": "Error de validación",
  "data": {
    "name": "El nombre del producto debe tener entre 3 y 100 caracteres",
    "price": "El precio del producto debe ser mayor a 0"
  }
}

Not found response — 404

Returned when no product with the given ID exists in the store.
{
  "responseCode": "404",
  "responseMessage": "Producto no encontrado con id: 99",
  "data": null
}

Build docs developers (and LLMs) love