En este artículo te mostramos cómo consultar el stock de tus productos mediante la API de Multivende.
La consulta de stock se realiza a productos asociados a una bodega en Multivende. Para consultar las bodegas que se encuentran creadas en una cuenta de merchant, lo puedes hacer mediante el endpoint: Get stores and warehouses.
Request:
curl --location -g '{{base_url}}/api/m/{{merchant_id}}/stores-and-warehouses/p/{{page}}' \
--header 'Authorization: Bearer {{access_token}}'
Response:
{
"entries": [
{
"_id": "xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"name": "Mi Tienda (Personaliza el nombre)",
"code": null,
"address": null,
"description": null,
"type": "store",
"phoneAreaCode": null,
"phoneNumber": null,
"latitude": 0,
"longitude": 0,
"openHours": null,
"tags": null,
"position": 0,
"status": "created",
"createdAt": "2018-05-24T00:19:31.000Z",
"updatedAt": "2018-05-24T00:19:31.000Z",
"CreatedById": "xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"UpdatedById": "xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"LocationId": null,
"TimezoneId": null,
"MerchantId": "xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"SalesGroupId": null
},
{
"_id": "xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"name": "Bodega (Personaliza el nombre)",
"code": null,
"address": null,
"description": null,
"type": "warehouse",
"phoneAreaCode": null,
"phoneNumber": null,
"latitude": 0,
"longitude": 0,
"openHours": null,
"tags": null,
"position": 1,
"status": "created",
"createdAt": "2018-05-24T00:19:31.000Z",
"updatedAt": "2018-05-24T00:19:31.000Z",
"CreatedById": "xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"UpdatedById": "xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"LocationId": null,
"TimezoneId": null,
"MerchantId": "xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"SalesGroupId": null
}
],
"pagination": {
"offset": 0,
"limit": 50,
"total_pages": 1,
"current_page": 1,
"next_page": 0,
"previous_page": 0,
"total_items": 2
}
}
Consultar stock de productos
Puedes consultar el stock de los productos mediante el endpoint Get stocks with scroll, enviando el id de la bodega, límite de items a consultar (el rango del límite permitido es >=50 y <=30000), este endpoint permite obtener el stock de los productos paginados por scroll.
Puedes consultar el stock por un rango de fecha y hora, filtrando por el parámetro de fecha de creación (createdAt) o fecha de actualización (updatedAt).
Consultar el histórico de movimientos de stock de un producto en una bodega
El historial de stock en bodega, puede ser consultado a través del endpoint Get stock history
este retorna todo el movimiento de stock del producto.
Podrás visualizar la información que se ve en la vista Movimiento de inventario desde la plataforma de Multivende.
Ejemplo response:
{
"entries": [
{
"_id": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxx",
"date": "2019-03-07T18:14:15.000Z",
"amount": 76,
"unitCost": 0,
"type": "INCREASE",
"comment": null,
"status": "created",
"createdAt": "2019-03-07T18:14:15.000Z",
"updatedAt": "2019-03-07T18:14:15.000Z",
"CreatedById": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxx",
"UpdatedById": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxx",
"CostCurrencyId": null,
"OriginProviderId": null,
"ProductRelocationCategoryId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxx",
"OriginWarehouseId": null,
"DestinationWarehouseId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxx",
"ProductVersionId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxx",
"MerchantId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxx",
"ProductStockBatchId": null,
"ProductRelocationCategory": {
"_id": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxx",
"name": "PRODUCT_RELOCATION_CATEGORIES.Product_reception.Name",
"certaintyLevel": "known",
"type": "increase",
"code": "_product_reception",
"description": "PRODUCT_RELOCATION_CATEGORIES.Product_reception.Description",
"position": 0,
"tags": "{ \"use_type\": \"external\"}",
"status": "created",
"createdAt": null,
"updatedAt": null
},
"CreatedBy": {
"profile": {
"name": "developers",
"fullName": "developers"
},
"token": {
"_id": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxx"
},
"_id": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxx",
"name": "developers",
"email": "developers-test@multivende.com"
},
"OriginWarehouse": null,
"DestinationWarehouse": {
"_id": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxx",
"name": "Bodega (Personaliza el nombre)",
"code": null,
"address": null,
"description": null,
"type": "warehouse",
"phoneAreaCode": null,
"phoneNumber": null,
"latitude": 0,
"longitude": 0,
"openHours": null,
"tags": null,
"position": 1,
"status": "created",
"createdAt": "2019-01-30T17:18:46.000Z",
"updatedAt": "2019-01-30T17:18:46.000Z",
"CreatedById": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxx",
"UpdatedById": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxx",
"LocationId": null,
"TimezoneId": null,
"MerchantId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxx",
"SalesGroupId": null
}
},
{
"_id": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxx",
"date": "2019-03-07T18:04:49.000Z",
"amount": 14,
"unitCost": 0,
"type": "INCREASE",
"comment": null,
"status": "created",
"createdAt": "2019-03-07T18:04:49.000Z",
"updatedAt": "2019-03-07T18:04:49.000Z",
"CreatedById": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxx",
"UpdatedById": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxx",
"CostCurrencyId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxx",
"OriginProviderId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxx",
"ProductRelocationCategoryId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxx",
"OriginWarehouseId": null,
"DestinationWarehouseId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxx",
"ProductVersionId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxx",
"MerchantId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxx",
"ProductStockBatchId": null,
"ProductRelocationCategory": {
"_id": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxx",
"name": "PRODUCT_RELOCATION_CATEGORIES.Product_reception.Name",
"certaintyLevel": "known",
"type": "increase",
"code": "_product_reception",
"description": "PRODUCT_RELOCATION_CATEGORIES.Product_reception.Description",
"position": 0,
"tags": "{ \"use_type\": \"external\"}",
"status": "created",
"createdAt": null,
"updatedAt": null
},
"CreatedBy": {
"profile": {
"name": "developers",
"fullName": "developers"
},
"token": {
"_id": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxx"
},
"_id": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxx",
"name": "developers",
"email": "developers-test@multivende.com"
},
"OriginWarehouse": null,
"DestinationWarehouse": {
"_id": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxx",
"name": "Bodega (Personaliza el nombre)",
"code": null,
"address": null,
"description": null,
"type": "warehouse",
"phoneAreaCode": null,
"phoneNumber": null,
"latitude": 0,
"longitude": 0,
"openHours": null,
"tags": null,
"position": 1,
"status": "created",
"createdAt": "2019-01-30T17:18:46.000Z",
"updatedAt": "2019-01-30T17:18:46.000Z",
"CreatedById": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxx",
"UpdatedById": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxx",
"LocationId": null,
"TimezoneId": null,
"MerchantId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxx",
"SalesGroupId": null
}
}
],
"pagination": {
"offset": 0,
"limit": 50,
"total_pages": 1,
"current_page": 1,
"next_page": 0,
"previous_page": 0,
"total_items": 2
}
}
Si tienes dudas sobre este tema contáctanos a través de api@multivende.com y estaremos felices de ayudarte.
Equipo Integraciones API Multivende