Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/TheSerchCp/SEAM-API/llms.txt

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

The PUT /api/v1/sidebar/:idItem endpoint performs a partial update on an existing sidebar navigation item. All three body fields — nameItem, iconItem, and route — are optional, so you can update only the specific field you need without touching the rest. The endpoint first verifies the item exists and returns a 404 if it does not, then applies the changes and returns the full updated record fetched fresh from the database.

Authentication

Requires a valid JWT in the Authorization header. The authenticated user’s role must also have the permission PUT /api/v1/sidebar/:idItem registered in the permissions table and assigned via permissionXRole.
Authorization: Bearer <token>

Request

Method: PUT
Path: /api/v1/sidebar/:idItem

Path Parameters

idItem
string
required
Numeric ID of the sidebar item to update. Must match the pattern ^\d+$ (digits only). Corresponds to the idItem primary key in the sidebarItems table.

Body Parameters

All body fields are optional. Include only the fields you want to change. Sending an empty body {} is valid but results in no changes being applied.
nameItem
string
New display label for the navigation item. Must be between 1 and 100 characters if provided.
iconItem
string
New icon identifier (e.g. CSS class name like "bi bi-gear"). Maximum 50 characters if provided.
route
string
New frontend route path (e.g. "/settings"). Maximum 100 characters if provided.

Example Request Body

{
  "nameItem": "System Settings",
  "route": "/settings/system"
}

Response

200 — Success

Returns the full updated sidebar item record after the changes are applied. The response reflects all current field values fetched via SELECT * FROM sidebarItems WHERE idItem = ?.
{
  "success": true,
  "message": "Sidebar item actualizado exitosamente",
  "data": {
    "idItem": 4,
    "nameItem": "System Settings",
    "iconItem": "bi bi-gear",
    "route": "/settings/system"
  }
}
success
boolean
Always true for successful responses.
message
string
Human-readable confirmation: "Sidebar item actualizado exitosamente".
data
object
The full updated sidebar item object, reflecting all current field values (not just the changed ones).
data.idItem
integer
Numeric ID of the sidebar item.
data.nameItem
string
Current display label after the update.
data.iconItem
string | null
Current icon identifier after the update, or null if not set.
data.route
string | null
Current route path after the update, or null if not set.

400 — Bad Request

Returned when the idItem path parameter is not a valid numeric string, or when a provided body field fails its length or type constraint.
{
  "success": false,
  "message": "idItem must match pattern ^\\d+$"
}

401 — Unauthorized

Returned when the Authorization header is missing or the token is invalid/expired.
{
  "success": false,
  "message": "Token inválido o expirado"
}

403 — Forbidden

Returned when the authenticated user’s role does not have the PUT /api/v1/sidebar/:idItem permission.
{
  "success": false,
  "message": "No tienes permisos para acceder a este recurso"
}

404 — Not Found

Returned when no sidebar item with the given idItem exists in the database. The check is performed by findItemById before the update is applied.
{
  "success": false,
  "message": "Sidebar item con id 4 no encontrado"
}

Example

curl -X PUT http://localhost:{PORT}/api/v1/sidebar/4 \
  -H "Authorization: Bearer <your_jwt_token>" \
  -H "Content-Type: application/json" \
  -d '{
    "nameItem": "System Settings",
    "route": "/settings/system"
  }'
Because all body fields are optional, you can perform field-level updates without re-sending unchanged data. For example, to rename an item while keeping its icon and route intact, send only { "nameItem": "New Label" }.

Real-time Events

This endpoint emits Socket.IO events throughout the update lifecycle:
EventStageDescription
sidebar:updatestartUpdate process initiated for the given item ID
sidebar:updateprocessingChecking existence, then persisting changes
sidebar:updatesuccessUpdate complete, payload includes the updated item

Build docs developers (and LLMs) love