Ir al contenido

Obtener un producto

GET/api/product/{id}

Devuelve un producto por su identificador. Admite relations para cargar relaciones y with_aggregates para agregar los totales de stock y los conteos.

idintegerobligatorio

Identificador de un producto.

relationsstring

Relaciones a cargar, por ejemplo brand,measurementUnit. El modelo no restringe las relaciones.

count_relationsstring

Conteos de relaciones. El modelo no define conteos permitidos.

with_aggregatesboolean

Con un valor verdadero, agrega stock_on_hand, stock_value, warehouses_count, provider_products_count y product_barcodes_count.

No exige un permiso del módulo: ProductPolicy::view devuelve verdadero para cualquier usuario autenticado.

Ventana de terminal
curl -G \
"https://servererp.allendostmen.app/api/product/1" \
-H "Authorization: Bearer $TOKEN" \
-H "Accept: application/json" \
--data-urlencode "relations=brand,measurementUnit"
Producto200
{
"id": 1,
"brand_id": 1,
"measurement_unit_id": 2,
"unified_index_id": null,
"code": "0000001",
"part_number": "NSX100F",
"name": "Interruptor termomagnético 3x100A",
"description": "Interruptor termomagnético tripolar de 100 A",
"features": null,
"search_keywords": "interruptor termomagnetico 3x100a nsx100f 0000001 schneider",
"buy_price": "120.00000000",
"sale_price": "150.00000000",
"stock": null,
"image": null,
"thumbnall": null,
"is_inventory_item": true,
"is_dropshipping_enabled": false,
"tracking_type": "none",
"picking_strategy": null,
"status": "activo",
"previous_status": null,
"status_update_comment": null,
"status_update_date": null,
"status_update_user_id": null,
"create_user_id": 1,
"update_user_id": null,
"delete_user_id": null,
"restore_user_id": null,
"created_at": "2026-11-19T10:40:15.000000Z",
"updated_at": "2026-11-19T10:40:15.000000Z",
"deleted_at": null,
"brand": {
"id": 1,
"name": "Schneider"
},
"measurement_unit": {
"id": 2,
"name": "Unidad"
}
}
No encontrado404
{
"message": "No query results for model [App\\Models\\Product] 3"
}
Sin permiso403
{
"message": "This action is unauthorized."
}