Listado de Productos
Puedes hacer uso de la API para solicitar la información general de uno o de todos los productos. También podrás filtrar por id del producto, codigo de producto, id de categoria entre otros.
api/products (GET)
Método para obtener listado de productos de acuerdo a parámetros definidos, para esto es necesario realizar una llamada GET a la siguiente url:
http://inventory.mdmn.cl/api/products
PARÁMETROS DE CONSULTA
Parámetros que pueden ser agregados a la solicitud para filtrar qué registros se desean obtener. Los parametros posibles son:
Campo | Tipo | Descripción |
---|---|---|
product_id | Integer | Id único del producto. |
bar_code | String | Código del producto. |
category_id | Integer | Id único de la categoría. |
page | Integer | Número de página. Por defecto = 1 |
result_per_page | Integer | Número de resultados por solicitud. Por defecto = 10000 (máximo 10000) |
Ejemplo
A continuación se muestra un ejemplo usando el método products de la API de Inventory.
METHOD GET curl "http://inventory.mdmn.cl/api/products?page=1&category_id=11' -X GET \ -H 'Authorization: Bearer <token>' -H 'Accept: application/json'
RESULTADO
El resultado ejemplo para esta llamada se muestra a continuación:
{
"data": [
{
"id": "132",
"code": null,
"bar_code": "1000024",
"name": "ARCHIVERO",
"description": "",
"purchase_price": "0",
"sale_price": "0",
"minimum_stock": "1",
"stock_ideal": "1",
"image": null,
"category_id": "11",
"status": "1",
"user_created": "23",
"created_at": "2023-12-13 08:09:24",
"user_updated": null,
"updated_at": null,
"has_serie": "0",
"has_location": "1",
"has_responsible": "0",
"category": "MOBILIARIO",
"presentation": "GENERICO",
"abbreviated_name": "GNR1",
"details": [
{
"purchase_price": "0",
"sale_price": "0",
"current_stock": "19",
"branch": "GENERICO",
"name": "ARCHIVERO",
"product_purchase_price": "0",
"product_sale_price": "0"
}
]
},
{
"id": "140",
"code": null,
"bar_code": "1000031",
"name": "ARMARIO",
"description": "",
"purchase_price": "0",
"sale_price": "0",
"minimum_stock": "1",
"stock_ideal": "1",
"image": null,
"category_id": "11",
"status": "1",
"user_created": "23",
"created_at": "2023-12-13 08:12:20",
"user_updated": null,
"updated_at": null,
"has_serie": "0",
"has_location": "1",
"has_responsible": "0",
"category": "MOBILIARIO",
"presentation": "GENERICO",
"abbreviated_name": "GNR1",
"details": []
},
{
"id": "262",
"code": null,
"bar_code": "1000153",
"name": "BANCA INFANT",
"description": "",
"purchase_price": "0",
"sale_price": "0",
"minimum_stock": "1",
"stock_ideal": "1",
"image": null,
"category_id": "11",
"status": "1",
"user_created": "23",
"created_at": "2023-12-28 09:32:28",
"user_updated": null,
"updated_at": null,
"has_serie": "0",
"has_location": "1",
"has_responsible": "0",
"category": "MOBILIARIO",
"presentation": "GENERICO",
"abbreviated_name": "GNR1",
"details": [
{
"purchase_price": "0",
"sale_price": "0",
"current_stock": "1",
"branch": "GENERICO",
"name": "BANCA INFANT",
"product_purchase_price": "0",
"product_sale_price": "0"
}
]
},
{
"id": "155",
"code": null,
"bar_code": "1000046",
"name": "BANCA PRE-ESCOLAR",
"description": "",
"purchase_price": "0",
"sale_price": "0",
"minimum_stock": "1",
"stock_ideal": "1",
"image": null,
"category_id": "11",
"status": "1",
"user_created": "23",
"created_at": "2023-12-13 08:19:49",
"user_updated": null,
"updated_at": null,
"has_serie": "0",
"has_location": "1",
"has_responsible": "0",
"category": "MOBILIARIO",
"presentation": "GENERICO",
"abbreviated_name": "GNR1",
"details": [
{
"purchase_price": "0",
"sale_price": "0",
"current_stock": "4",
"branch": "GENERICO",
"name": "BANCA PRE-ESCOLAR",
"product_purchase_price": "0",
"product_sale_price": "0"
}
]
},
{
"id": "186",
"code": null,
"bar_code": "1000077",
"name": "CAJONERA",
"description": "",
"purchase_price": "0",
"sale_price": "0",
"minimum_stock": "1",
"stock_ideal": "1",
"image": null,
"category_id": "11",
"status": "1",
"user_created": "23",
"created_at": "2023-12-13 08:45:10",
"user_updated": null,
"updated_at": null,
"has_serie": "0",
"has_location": "1",
"has_responsible": "0",
"category": "MOBILIARIO",
"presentation": "GENERICO",
"abbreviated_name": "GNR1",
"details": [
{
"purchase_price": "0",
"sale_price": "0",
"current_stock": "52",
"branch": "GENERICO",
"name": "CAJONERA",
"product_purchase_price": "0",
"product_sale_price": "0"
}
]
}
],
"totalPages": 1,
"currentPage": "1",
"totalRecords": 5
}